+
+
+
diff --git a/includes/core/recaptcha/index.php b/includes/core/recaptcha/index.php
index e05a34fe..763078bb 100644
--- a/includes/core/recaptcha/index.php
+++ b/includes/core/recaptcha/index.php
@@ -315,12 +315,16 @@ function validate_recaptcha_customer( $customer_args, $form, $form_data, $form_v
throw new \Exception( __( 'Invalid reCAPTCHA. Please try again.', 'stripe' ) );
}
}
-add_action(
- 'simpay_before_customer_from_payment_form_request',
- __NAMESPACE__ . '\\validate_recaptcha_customer',
- 10,
- 4
-);
+// Only validate reCAPTCHA here if UPE is not enabled. Otherwise it is handled
+// in the updated `wpsp/__internal__payment` endpoint.
+if ( ! simpay_is_upe() ) {
+ add_action(
+ 'simpay_before_customer_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_recaptcha_customer',
+ 10,
+ 4
+ );
+}
/**
* Validates reCAPTCHA before PaymentIntent creation.
@@ -364,30 +368,34 @@ function validate_recaptcha_payment( $paymentintent_args, $form, $form_data, $fo
throw new \Exception( __( 'Invalid reCAPTCHA. Please try again.', 'stripe' ) );
}
}
-add_action(
- 'simpay_before_paymentintent_from_payment_form_request',
- __NAMESPACE__ . '\\validate_recaptcha_payment',
- 10,
- 4
-);
-add_action(
- 'simpay_before_subscription_from_payment_form_request',
- __NAMESPACE__ . '\\validate_recaptcha_payment',
- 10,
- 4
-);
-add_action(
- 'simpay_before_charge_from_payment_form_request',
- __NAMESPACE__ . '\\validate_recaptcha_payment',
- 10,
- 4
-);
-add_action(
- 'simpay_before_checkout_session_from_payment_form_request',
- __NAMESPACE__ . '\\validate_recaptcha_payment',
- 10,
- 4
-);
+// Only validate reCAPTCHA here if UPE is not enabled. Otherwise it is handled
+// in the updated `wpsp/__internal__payment` endpoint.
+if ( ! simpay_is_upe() ) {
+ add_action(
+ 'simpay_before_paymentintent_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_recaptcha_payment',
+ 10,
+ 4
+ );
+ add_action(
+ 'simpay_before_subscription_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_recaptcha_payment',
+ 10,
+ 4
+ );
+ add_action(
+ 'simpay_before_charge_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_recaptcha_payment',
+ 10,
+ 4
+ );
+ add_action(
+ 'simpay_before_checkout_session_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_recaptcha_payment',
+ 10,
+ 4
+ );
+}
/**
* Validates hCaptcha before payment action.
@@ -436,24 +444,28 @@ function validate_hcaptcha_payment( $paymentintent_args, $form, $form_data, $for
);
}
}
-add_action(
- 'simpay_before_paymentintent_from_payment_form_request',
- __NAMESPACE__ . '\\validate_hcaptcha_payment',
- 10,
- 4
-);
-add_action(
- 'simpay_before_subscription_from_payment_form_request',
- __NAMESPACE__ . '\\validate_hcaptcha_payment',
- 10,
- 4
-);
-add_action(
- 'simpay_before_checkout_session_from_payment_form_request',
- __NAMESPACE__ . '\\validate_hcaptcha_payment',
- 10,
- 4
-);
+// Only validate hCaptcha here if UPE is not enabled. Otherwise it is handled
+// in the updated `wpsp/__internal__payment` endpoint.
+if ( ! simpay_is_upe() ) {
+ add_action(
+ 'simpay_before_paymentintent_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_hcaptcha_payment',
+ 10,
+ 4
+ );
+ add_action(
+ 'simpay_before_subscription_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_hcaptcha_payment',
+ 10,
+ 4
+ );
+ add_action(
+ 'simpay_before_checkout_session_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_hcaptcha_payment',
+ 10,
+ 4
+ );
+}
/**
* Validates reCAPTCHA before Order preview.
@@ -499,12 +511,16 @@ function validate_recaptcha_order_preview( $request, $form ) {
throw new \Exception( __( 'Invalid reCAPTCHA. Please try again.', 'stripe' ) );
}
}
-add_action(
- 'simpay_before_order_preview_from_payment_form_request',
- __NAMESPACE__ . '\\validate_recaptcha_order_preview',
- 10,
- 2
-);
+// Only validate hCaptcha here if UPE is not enabled. Otherwise it is handled
+// in the updated `wpsp/__internal__payment` endpoint.
+if ( ! simpay_is_upe() ) {
+ add_action(
+ 'simpay_before_order_preview_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_recaptcha_order_preview',
+ 10,
+ 2
+ );
+}
/**
* Validates reCAPTCHA before Order submission.
@@ -550,12 +566,16 @@ function validate_recaptcha_order_submit( $request, $form ) {
throw new \Exception( __( 'Invalid reCAPTCHA. Please try again.', 'stripe' ) );
}
}
-add_action(
- 'simpay_before_order_submit_from_payment_form_request',
- __NAMESPACE__ . '\\validate_recaptcha_order_submit',
- 10,
- 2
-);
+// Only validate hCaptcha here if UPE is not enabled. Otherwise it is handled
+// in the updated `wpsp/__internal__payment` endpoint.
+if ( ! simpay_is_upe() ) {
+ add_action(
+ 'simpay_before_order_submit_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_recaptcha_order_submit',
+ 10,
+ 2
+ );
+}
/**
* Validates hCaptcha before Order submission.
@@ -594,12 +614,16 @@ function validate_hcaptcha_order_submit( $request, $form ) {
);
}
}
-add_action(
- 'simpay_before_order_submit_from_payment_form_request',
- __NAMESPACE__ . '\\validate_hcaptcha_order_submit',
- 10,
- 2
-);
+// Only validate hCaptcha here if UPE is not enabled. Otherwise it is handled
+// in the updated `wpsp/__internal__payment` endpoint.
+if ( ! simpay_is_upe() ) {
+ add_action(
+ 'simpay_before_order_submit_from_payment_form_request',
+ __NAMESPACE__ . '\\validate_hcaptcha_order_submit',
+ 10,
+ 2
+ );
+}
/**
* Adds an Inbox notification if no CAPTCHA type has been set.
diff --git a/includes/core/rest-api/class-controller.php b/includes/core/rest-api/class-controller.php
index bb1e74ca..51af4f19 100644
--- a/includes/core/rest-api/class-controller.php
+++ b/includes/core/rest-api/class-controller.php
@@ -91,16 +91,11 @@ protected function permission_checks( $checks, $request ) {
protected function check_rate_limit( $request ) {
$has_exceeded_rate_limit = false;
- /**
- * Filters if the current IP address has exceeded the rate limit.
- *
- * @since 3.9.5
- *
- * @param bool $has_exceeded_rate_limit
- */
+ /** This filter is documented in src/RestApi/Internal/Payment/AbstractPaymentCreateRoute.php */
$has_exceeded_rate_limit = apply_filters(
'simpay_has_exceeded_rate_limit',
- $has_exceeded_rate_limit
+ $has_exceeded_rate_limit,
+ $request
);
if ( true === $has_exceeded_rate_limit ) {
diff --git a/includes/core/rest-api/v2/class-checkout-session-controller.php b/includes/core/rest-api/v2/class-checkout-session-controller.php
index 780ffb1f..aba078bc 100644
--- a/includes/core/rest-api/v2/class-checkout-session-controller.php
+++ b/includes/core/rest-api/v2/class-checkout-session-controller.php
@@ -10,6 +10,7 @@
namespace SimplePay\Core\REST_API\v2;
+use SimplePay\Core\API;
use SimplePay\Core\Payments;
use SimplePay\Core\REST_API\Controller;
use SimplePay\Core\Legacy;
@@ -158,7 +159,7 @@ public function create_item( $request ) {
$customer_id
);
- $session = Payments\Stripe_Checkout\Session\create(
+ $session = API\CheckoutSessions\create(
$session_args,
$form->get_api_request_args()
);
diff --git a/includes/core/rest-api/v2/class-paymentintent-controller.php b/includes/core/rest-api/v2/class-paymentintent-controller.php
index 546517db..523e82d8 100644
--- a/includes/core/rest-api/v2/class-paymentintent-controller.php
+++ b/includes/core/rest-api/v2/class-paymentintent-controller.php
@@ -10,6 +10,7 @@
namespace SimplePay\Core\REST_API\v2;
+use SimplePay\Core\API;
use SimplePay\Core\REST_API\Controller;
use SimplePay\Core\Payments;
use SimplePay\Core\Legacy;
@@ -194,7 +195,7 @@ public function create_item( $request ) {
);
// Generate a PaymentIntent.
- $paymentintent = Payments\PaymentIntent\create(
+ $paymentintent = API\PaymentIntents\create(
$paymentintent_args,
$form->get_api_request_args()
);
diff --git a/includes/core/settings/register-general.php b/includes/core/settings/register-general.php
index d9f57ee2..4f5ca2f4 100644
--- a/includes/core/settings/register-general.php
+++ b/includes/core/settings/register-general.php
@@ -12,6 +12,7 @@
use SimplePay\Core\Settings;
use SimplePay\Core\i18n;
+use SimplePay\Core\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -204,7 +205,7 @@ function register_currency_settings( $settings ) {
)
),
'priority' => 30,
- 'schema' => array(
+ 'schema' => array(
'type' => 'string',
'enum' => array( 'yes', 'no' ),
),
@@ -223,6 +224,77 @@ function register_currency_settings( $settings ) {
function register_advanced_settings( $settings ) {
$license = simpay_get_license();
+ // UPE.
+ $settings->add(
+ new Settings\Setting_Checkbox(
+ array(
+ 'id' => 'is_upe',
+ 'section' => 'general',
+ 'subsection' => 'advanced',
+ 'label' => true === $license->is_lite()
+ ? esc_html_x(
+ 'Use the Latest API Version',
+ 'setting label',
+ 'stripe'
+ )
+ : esc_html_x(
+ 'New Payment Experience',
+ 'setting label',
+ 'stripe'
+ ),
+ 'input_label' => true === $license->is_lite()
+ ? esc_html_x(
+ 'Use Stripe API version 2022-11-15',
+ 'setting input label',
+ 'stripe'
+ )
+ : esc_html_x(
+ '✨ Try the new payment experience (early access) ✨',
+ 'setting input label',
+ 'stripe'
+ ),
+ 'value' => simpay_get_setting(
+ 'is_upe',
+ $license->is_lite() ? 'yes' : 'no'
+ ),
+ 'description' => true === $license->is_lite()
+ ? ''
+ : wpautop(
+ wp_kses(
+ sprintf(
+ /* translators: %1$s Opening , do not translate. %2$s Closing , do not translate. %3$s Opening tag, do not translate. %4$s Closing tag, do not translate. */
+ __(
+ 'Get early acess to a new, smarter payment experience. %1$sNot recommended for merchants with a custom payment flow/custom code%2$s. Have questions about upgrading? %3$sContact us%4$s',
+ 'stripe'
+ ),
+ '',
+ '',
+ '',
+ Utils\get_external_link_markup() . ''
+ ),
+ array(
+ 'strong' => array(),
+ 'a' => array(
+ 'href' => true,
+ 'rel' => true,
+ 'target' => true,
+ 'class' => true,
+ ),
+ 'span' => array(
+ 'class' => true,
+ ),
+ )
+ )
+ ),
+ 'priority' => 0,
+ 'schema' => array(
+ 'type' => 'string',
+ 'enum' => array( 'yes', 'no' ),
+ ),
+ )
+ )
+ );
+
if ( true === $license->is_lite() ) {
/**
* Filters if Usage Tracking should be enabled by default.
@@ -304,4 +376,4 @@ function register_advanced_settings( $settings ) {
)
)
);
-}
\ No newline at end of file
+}
diff --git a/includes/core/utils/class-rate-limiting.php b/includes/core/utils/class-rate-limiting.php
index f79eb979..b2a16f9d 100644
--- a/includes/core/utils/class-rate-limiting.php
+++ b/includes/core/utils/class-rate-limiting.php
@@ -23,6 +23,14 @@
*/
class Rate_Limiting {
+ /**
+ * Payment request.
+ *
+ * @since 4.7.0
+ * @var \WP_REST_Request
+ */
+ private $request;
+
/**
* Is the file writable.
*
@@ -68,7 +76,10 @@ public function init() {
*
* @link https://github.com/WP-API/WP-API/issues/2400#issuecomment-202620551
*/
- add_filter( 'simpay_has_exceeded_rate_limit', array( $this, 'has_hit_limit' ) );
+ add_filter(
+ 'simpay_has_exceeded_rate_limit',
+ array( $this, 'has_hit_limit' ), 10, 2
+ );
}
/**
@@ -135,13 +146,19 @@ public function cleanup_log() {
*
* @since 3.9.5
*
+ * @param bool $hit Whether the rate limit has been hit.
+ * @param \WP_REST_Request $request The request object.
+ *
* @return bool
*/
- public function has_hit_limit() {
+ public function has_hit_limit( $hit, $request ) {
if ( ! $this->rate_limiting_enabled() ) {
return false;
}
+ // Store the request.
+ $this->request = $request;
+
$count = $this->increment_rate_limit_count();
$blocking_id = $this->get_rate_limit_id();
@@ -154,7 +171,8 @@ public function has_hit_limit() {
return false;
}
- $max_rate_count = 18;
+ // UPE makes single requests, so it should be lower.
+ $max_rate_count = simpay_is_upe() ? 5 : 18;
/**
* Filters the number of times the endpoint can be hit within the specified time period (1 hour).
@@ -304,6 +322,7 @@ public function rate_limiting_enabled() {
*
* @since 3.9.5
*
+ * @param \WP_REST_Request|null $request The request object.
* @return string
*/
public function get_rate_limit_id() {
@@ -316,7 +335,7 @@ public function get_rate_limit_id() {
*
* @param string $id The rate limiting tracking ID.
*/
- $id = apply_filters( 'simpay_rate_limiting_id', $id );
+ $id = apply_filters( 'simpay_rate_limiting_id', $id, $this->request );
return $id;
}
diff --git a/lib/Stripe/CHANGELOG.md b/lib/Stripe/CHANGELOG.md
index 62308ec5..5be9a4c4 100644
--- a/lib/Stripe/CHANGELOG.md
+++ b/lib/Stripe/CHANGELOG.md
@@ -1,5 +1,204 @@
# Changelog
+## 10.6.0-beta.1 - 2023-02-02
+* [#1440](https://github.com/stripe/stripe-php/pull/1440) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for `all` method on resource `Transaction`
+ * Add support for `inferred_balances_refresh`, `subscriptions`, and `transaction_refresh` on `FinancialConnections.Account`
+ * Add support for `manual_entry`, `prefetch`, `status_details`, and `status` on `FinancialConnections.Session`
+ * Add support for new resource `FinancialConnections.Transaction`
+
+## 10.5.0 - 2023-02-02
+* [#1439](https://github.com/stripe/stripe-php/pull/1439) API Updates
+ * Add support for `resume` method on resource `Subscription`
+ * Add support for `amount_shipping` and `shipping_cost` on `CreditNote` and `Invoice`
+ * Add support for `shipping_details` on `Invoice`
+ * Add support for `invoice_creation` on `PaymentLink`
+ * Add support for `trial_settings` on `Subscription`
+ * Add support for new value `paused` on enum `Subscription.status`
+
+## 10.5.0-beta.2 - 2023-01-26
+* [#1429](https://github.com/stripe/stripe-php/pull/1429) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for `list_transactions` method on resource `Tax.Transaction`
+
+## 10.5.0-beta.1 - 2023-01-19
+* [#1427](https://github.com/stripe/stripe-php/pull/1427) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for `Tax.Settings` resource.
+
+## 10.4.0 - 2023-01-19
+* [#1381](https://github.com/stripe/stripe-php/pull/1381) Add getService methods to StripeClient and AbstractServiceFactory to allow mocking
+* [#1424](https://github.com/stripe/stripe-php/pull/1424) API Updates
+
+ * Added `REFUND_CREATED`, `REFUND_UPDATED` event definitions.
+* [#1426](https://github.com/stripe/stripe-php/pull/1426) Ignore PHP version for formatting
+* [#1425](https://github.com/stripe/stripe-php/pull/1425) Fix Stripe::setAccountId parameter type
+* [#1418](https://github.com/stripe/stripe-php/pull/1418) Switch to mb_convert_encoding to fix utf8_encode deprecation warning
+
+## 10.4.0-beta.3 - 2023-01-12
+* [#1423](https://github.com/stripe/stripe-php/pull/1423) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for `Tax.Registration` resource.
+ * Change `draft_quote` method implementation from hitting `/v1/quotes/{quotes}/draft` to `/v1/quotes/{quotes}/mark_draft`
+
+## 10.4.0-beta.2 - 2023-01-05
+* [#1420](https://github.com/stripe/stripe-php/pull/1420) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for `mark_stale_quote` method on resource `Quote`
+
+## 10.4.0-beta.1 - 2022-12-22
+* [#1414](https://github.com/stripe/stripe-php/pull/1414) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Move `$stripe->taxCalculations` to `$stripe->tax->calculations` and `$stripe->taxTransactions` to `$stripe->tax->transactions`
+
+## 10.3.0 - 2022-12-22
+* [#1413](https://github.com/stripe/stripe-php/pull/1413) API Updates
+ Change `CheckoutSession.cancel_url` to be nullable.
+
+## 10.3.0-beta.1 - 2022-12-15
+* [#1412](https://github.com/stripe/stripe-php/pull/1412) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for new resources `QuoteLine`, `TaxCalculation`, and `TaxTransaction`
+ * Add support for `create` and `list_line_items` methods on resource `TaxCalculation`
+ * Add support for `create_reversal`, `create`, and `retrieve` methods on resource `TaxTransaction`
+
+## 10.2.0 - 2022-12-15
+* [#1411](https://github.com/stripe/stripe-php/pull/1411) API Updates
+ * Add support for new value `invoice_overpaid` on enum `CustomerBalanceTransaction.type`
+* [#1407](https://github.com/stripe/stripe-php/pull/1407) API Updates
+
+## 10.2.0-beta.1 - 2022-12-08
+* [#1408](https://github.com/stripe/stripe-php/pull/1408) API Updates for beta branch
+ * Updated stable APIs to the latest version
+* [#1406](https://github.com/stripe/stripe-php/pull/1406) API Updates for beta branch
+ * Updated stable APIs to the latest version
+* [#1398](https://github.com/stripe/stripe-php/pull/1398) API Updates for beta branch
+ * Updated stable APIs to the latest version
+
+## 10.1.0 - 2022-12-06
+* [#1405](https://github.com/stripe/stripe-php/pull/1405) API Updates
+ * Add support for `flow` on `BillingPortal.Session`
+* [#1404](https://github.com/stripe/stripe-php/pull/1404) API Updates
+ * Remove support for resources `Order` and `Sku`
+ * Remove support for `all`, `cancel`, `create`, `list_line_items`, `reopen`, `retrieve`, `submit`, and `update` methods on resource `Order`
+ * Remove support for `all`, `create`, `delete`, `retrieve`, and `update` methods on resource `Sku`
+ * Add support for `custom_text` on `Checkout.Session` and `PaymentLink`
+ * Add support for `invoice_creation` and `invoice` on `Checkout.Session`
+ * Remove support for `product` on `LineItem`
+ * Add support for `latest_charge` on `PaymentIntent`
+ * Remove support for `charges` on `PaymentIntent`
+
+## 10.0.0 - 2022-11-16
+* [#1392](https://github.com/stripe/stripe-php/pull/1392) Next major release changes
+
+Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the Stripe products, read more at https://stripe.com/docs/upgrades#2022-11-15.
+
+"⚠️" symbol highlights breaking changes.
+
+## 9.9.0 - 2022-11-08
+* [#1394](https://github.com/stripe/stripe-php/pull/1394) API Updates
+ * Add support for new values `eg_tin`, `ph_tin`, and `tr_tin` on enum `TaxId.type`
+* [#1389](https://github.com/stripe/stripe-php/pull/1389) API Updates
+ * Add support for `on_behalf_of` on `Subscription`
+* [#1379](https://github.com/stripe/stripe-php/pull/1379) Do not run Coveralls in PR-s
+
+## 9.9.0-beta.2 - 2022-11-02
+* [#1390](https://github.com/stripe/stripe-php/pull/1390) API Updates for beta branch
+ * Updated beta APIs to the latest stable version
+
+## 9.9.0-beta.1 - 2022-10-21
+* [#1384](https://github.com/stripe/stripe-php/pull/1384) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for `network_data` on `Issuing.Transaction`
+ * Add support for `paypal` on `Source`
+ * Add support for new value `paypal` on enum `Source.type`
+
+## 9.8.0 - 2022-10-20
+* [#1383](https://github.com/stripe/stripe-php/pull/1383) API Updates
+ * Add support for new values `jp_trn` and `ke_pin` on enum `TaxId.type`
+* [#1293](https://github.com/stripe/stripe-php/pull/1293) Install deps in the install step of CI
+* [#1291](https://github.com/stripe/stripe-php/pull/1291) Fix: Configure finder for `friendsofphp/php-cs-fixer`
+
+## 9.7.0 - 2022-10-13
+* [#1376](https://github.com/stripe/stripe-php/pull/1376) API Updates
+ * Add support for `network_data` on `Issuing.Authorization`
+* [#1374](https://github.com/stripe/stripe-php/pull/1374) Add request_log_url on ErrorObject
+* [#1370](https://github.com/stripe/stripe-php/pull/1370) API Updates
+ * Add support for `created` on `Checkout.Session`
+
+## 9.7.0-beta.2 - 2022-10-07
+* [#1373](https://github.com/stripe/stripe-php/pull/1373) API Updates for beta branch
+ * Updated stable APIs to the latest version
+
+## 9.7.0-beta.1 - 2022-09-26
+* [#1368](https://github.com/stripe/stripe-php/pull/1368) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add `FinancingOffer`, `FinancingSummary` and `FinancingTransaction` resources.
+
+## 9.6.0 - 2022-09-15
+* [#1365](https://github.com/stripe/stripe-php/pull/1365) API Updates
+ * Add support for `from_invoice` and `latest_revision` on `Invoice`
+ * Add support for new value `pix` on enum `PaymentLink.payment_method_types[]`
+ * Add support for `pix` on `PaymentMethod`
+ * Add support for new value `pix` on enum `PaymentMethod.type`
+ * Add support for `created` on `Treasury.CreditReversal` and `Treasury.DebitReversal`
+
+## 9.5.0 - 2022-09-06
+* [#1364](https://github.com/stripe/stripe-php/pull/1364) API Updates
+ * Add support for new value `terminal_reader_splashscreen` on enum `File.purpose`
+* [#1363](https://github.com/stripe/stripe-php/pull/1363) chore: Update PHP tests to handle search methods.
+
+## 9.4.0 - 2022-08-26
+* [#1362](https://github.com/stripe/stripe-php/pull/1362) API Updates
+ * Add support for `login_page` on `BillingPortal.Configuration`
+* [#1360](https://github.com/stripe/stripe-php/pull/1360) Add test coverage using Coveralls
+* [#1361](https://github.com/stripe/stripe-php/pull/1361) fix: Fix type hints for error objects.
+ * Update `Invoice.last_finalization_error`, `PaymentIntent.last_payment_error`, `SetupAttempt.setup_error` and `SetupIntent.setup_error` type to be `StripeObject`.
+ * Addresses https://github.com/stripe/stripe-php/issues/1353. The library today does not actually return a `ErrorObject` for these fields, so the type annotation was incorrect.
+* [#1356](https://github.com/stripe/stripe-php/pull/1356) Add beta readme.md section
+
+## 9.4.0-beta.1 - 2022-08-26
+* [#1358](https://github.com/stripe/stripe-php/pull/1358) API Updates for beta branch
+ * Updated stable APIs to the latest version
+ * Add support for the beta [Gift Card API](https://stripe.com/docs/gift-cards).
+
+## 9.3.0 - 2022-08-23
+* [#1355](https://github.com/stripe/stripe-php/pull/1355) API Updates
+ * Change type of `Treasury.OutboundTransfer.destination_payment_method` from `string` to `string | null`
+ * Change the return type of `CustomerService.fundCashBalance` test helper from `CustomerBalanceTransaction` to `CustomerCashBalanceTransaction`.
+ * This would generally be considered a breaking change, but we've worked with all existing users to migrate and are comfortable releasing this as a minor as it is solely a test helper method. This was essentially broken prior to this change.
+
+## 9.3.0-beta.1 - 2022-08-23
+* [#1354](https://github.com/stripe/stripe-php/pull/1354) API Updates for beta branch
+ - Updated stable APIs to the latest version
+ - `Stripe-Version` beta headers are not pinned by-default and need to be manually specified, please refer to [beta SDKs README section](https://github.com/stripe/stripe-php/blob/master/README.md#beta-sdks)
+
+## 9.2.0 - 2022-08-19
+* [#1352](https://github.com/stripe/stripe-php/pull/1352) API Updates
+ * Add support for new resource `CustomerCashBalanceTransaction`
+ * Add support for `currency` on `PaymentLink`
+ * Add constant for `customer_cash_balance_transaction.created` webhook event.
+* [#1351](https://github.com/stripe/stripe-php/pull/1351) Add a support section to the readme
+* [#1304](https://github.com/stripe/stripe-php/pull/1304) Allow passing PSR-3 loggers to setLogger as they are compatible
+
+## 9.2.0-beta.1 - 2022-08-11
+* [#1349](https://github.com/stripe/stripe-php/pull/1349) API Updates for beta branch
+ - Updated stable APIs to the latest version
+ - Add `refundPayment` method to Terminal resource
+
+## 9.1.0 - 2022-08-11
+* [#1348](https://github.com/stripe/stripe-php/pull/1348) API Updates
+ * Add support for `payment_method_collection` on `Checkout.Session` and `PaymentLink`
+
+* [#1346](https://github.com/stripe/stripe-php/pull/1346) API Updates
+ * Add support for `expires_at` on `Apps.Secret`
+
+## 9.1.0-beta.1 - 2022-08-03
+* [#1345](https://github.com/stripe/stripe-php/pull/1345) API Updates for beta branch
+ - Updated stable APIs to the latest version
+ - Added the `Order` resource support
+
## 9.0.0 - 2022-08-02
Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the SDK, read more detailed description at https://github.com/stripe/stripe-php/wiki/Migration-guide-for-v9. For changes to the Stripe products, read more at https://stripe.com/docs/upgrades#2022-08-01.
@@ -11,43 +210,30 @@ Breaking changes that arose during code generation of the library that we postpo
* [#1273](https://github.com/stripe/stripe-php/pull/1273) Add some PHPDoc return types and fixes
* [#1341](https://github.com/stripe/stripe-php/pull/1341) Next major release changes
-### Added
-* Add `alternate_statement_descriptors`, `authorization_code`, and `level3` properties to `Charge` resource.
-* Add `previewLines` method to `CreditNote` resource.
-* Add `transfer_data` property to `Subscription` resource.
-* Add `SOURCE_TYPE_FPX` constant to `Transfer` resource.
-* Add new error code constants to `ErrorObject`.
-* Add support for `shipping_cost` and `shipping_details` on `Checkout.Session`
-
-### ⚠️ Changed
-* Updated certificate bundle ([#1314](https://github.com/stripe/stripe-php/pull/1314))
-* Add `params` parameter to `close` method in `Dispute` resource.
-
-### ⚠️ Removed
-* Remove deprecated `AlipayAccount`, `BitcoinReceiver`, `BitcoinTransaction`, `Recipient`, `RecipientTransfer`, and `ThreeDSecure` resources.
-* Remove `CAPABILITY_CARD_PAYMENTS`, `CAPABILITY_LEGACY_PAYMENTS`, `CAPABILITY_PLATFORM_PAYMENTS`, `CAPABILITY_TRANSFERS`, `CAPABILITY_STATUS_ACTIVE`, `CAPABILITY_STATUS_INACTIVE`, and `CAPABILITY_STATUS_PENDING` constants from `Account` resource. Please use up-to-date values from https://stripe.com/docs/connect/account-capabilities.
-* Remove `AssociatedObjects` array property from `EphemeralKey` resource. The field was undocumented and unsupported.
-* Remove `details` method from `Card` resource. The endpoint was deprecated and no longer exists.
-* Remove `recipient` property from `Card` resource. The property was deprecated.
-* Remove ability to list `Card` resources for a particular `Recipient`.
-* Remove `sources` property from `Card` resource. The property was deprecated.
-* Remove `FAILURE_REASON` constant from `Refund` resource. The value was deprecated.
-* Remove `Recipient` resource. The resource was deprecated.
-* Remove `OrderItem` resource. The resource was deprecated.
-* Remove `all` method from `LineItem`.
-* Remove `cancel` method from `Transfer` and `TransferService`. This method is deprecated.
-* Remove `allTransactions` method from `SourceService` service. Please use `allSourceTransactions` method instead.
-* Remove `persons` method from `Account` resource. Please use `allPersons` method instead.
-* Remove `sourceTransactions` method from `Source` resource. Please use `allSourceTransactions` method instead.
-* Remove `usageRecordSummaries` method from `SubscriptionItem` resource. Please use `allUsageRecordSummaries` method instead.
-* Remove `SOURCE_TYPE_ALIPAY_ACCOUNT` and `SOURCE_TYPE_FINANCING` constants from `Transfer` resource. The values were deprecated and are no longer in use.
-* Remove deprecated error code constants from `ErrorObject`: `CODE_ACCOUNT_ALREADY_EXISTS`, `CODE_ORDER_CREATION_FAILED`, `CODE_ORDER_REQUIRED_SETTINGS`, `CODE_ORDER_STATUS_INVALID`, `CODE_ORDER_UPSTREAM_TIMEOUT`, and `CODE_UPSTREAM_ORDER_CREATION_FAILED`.
-* Remove deprecated event constants from `Webhook`: `ISSUER_FRAUD_RECORD_CREATED`, ` ORDER_PAYMENT_FAILED`, `ORDER_PAYMENT_SUCCEEDED`, `ORDER_UPDATED`, `ORDER_RETURN_CREATED`, `PAYMENT_METHOD_CARD_AUTOMATICALLY_UPDATED`, `PING`, `PROMOTION_CODE_DELETED`, and `TREASURY_RECEIVED_CREDIT_REVERSED`. The events are deprecated and no longer sent by Stripe.
-
## 8.12.0 - 2022-07-25
* [#1332](https://github.com/stripe/stripe-php/pull/1332) API Updates
* Add support for `default_currency` and `invoice_credit_balance` on `Customer`
+## 8.12.0-beta.1 - 2022-07-22
+* [#1331](https://github.com/stripe/stripe-php/pull/1331) API Updates for beta branch
+ - Updated stable APIs to the latest version
+* [#1328](https://github.com/stripe/stripe-php/pull/1328) API Updates for beta branch
+ - Updated stable APIs to the latest version
+ - Add `QuotePhase` resource
+* [#1325](https://github.com/stripe/stripe-php/pull/1325) API Updates for beta branch
+ - Updated stable APIs to the latest version
+ - Add `QuotePhaseConfiguration` service.
+ - Add `Price.migrate_to` property
+ - Add `SubscriptionSchedule.amend` method.
+ - Add `Discount.subscription_item` property.
+ - Add `Quote.subscription_data.billing_behavior`, `billing_cycle_anchor`, `end_behavior`, `from_schedule`, `from_subscription`, `prebilling`, `proration_behavior` properties.
+ - Add `phases` parameter to `Quote.create`
+ - Add `Subscription.discounts`, `prebilling` properties.
+* [#1320](https://github.com/stripe/stripe-php/pull/1320) API Updates for beta branch
+ - Include `server_side_confirmation_beta=v1` beta
+ - Add `secretKeyConfirmation` to `PaymentIntent`
+* [#1317](https://github.com/stripe/stripe-php/pull/1317) API Updates for beta branch
+ - Updated stable APIs to the latest version
## 8.11.0 - 2022-07-18
* [#1324](https://github.com/stripe/stripe-php/pull/1324) API Updates
@@ -113,7 +299,6 @@ Breaking changes that arose during code generation of the library that we postpo
* Add support for `id_number_secondary_provided` on `Person`
* [#1295](https://github.com/stripe/stripe-php/pull/1295) API Updates
-
## 8.3.0 - 2022-05-23
* [#1294](https://github.com/stripe/stripe-php/pull/1294) API Updates
* Add support for new resource `Apps.Secret`
@@ -153,7 +338,6 @@ Breaking changes that arose during code generation of the library that we postpo
* 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`
@@ -184,7 +368,6 @@ Breaking changes that arose during code generation of the library that we postpo
* 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`
@@ -222,7 +405,6 @@ Breaking changes that arose during code generation of the library that we postpo
* 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`
@@ -233,7 +415,6 @@ Breaking changes that arose during code generation of the library that we postpo
* [#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`
@@ -258,7 +439,6 @@ Breaking changes that arose during code generation of the library that we postpo
* 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`
@@ -403,7 +583,6 @@ Breaking changes that arose during code generation of the library that we postpo
* [#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`
@@ -471,7 +650,6 @@ Breaking changes that arose during code generation of the library that we postpo
* 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
@@ -1793,3 +1971,4 @@ Pull requests included in this release:
- Add new Transfer resource
- Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward)
- Numerous test suite improvements
+
diff --git a/lib/Stripe/Makefile b/lib/Stripe/Makefile
index 04a4dce9..68c1586d 100644
--- a/lib/Stripe/Makefile
+++ b/lib/Stripe/Makefile
@@ -12,11 +12,11 @@ test: vendor
.PHONY: test
fmt: vendor
- vendor/bin/php-cs-fixer fix -v --using-cache=no .
+ PHP_CS_FIXER_IGNORE_ENV=true vendor/bin/php-cs-fixer fix -v --using-cache=no
.PHONY: fmt
fmtcheck: vendor
- vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no .
+ PHP_CS_FIXER_IGNORE_ENV=true vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no
.PHONY: fmtcheck
phpdoc: vendor/bin/phpdoc
diff --git a/lib/Stripe/OPENAPI_VERSION b/lib/Stripe/OPENAPI_VERSION
index 714ead97..4e134f2a 100644
--- a/lib/Stripe/OPENAPI_VERSION
+++ b/lib/Stripe/OPENAPI_VERSION
@@ -1 +1 @@
-v174
\ No newline at end of file
+v223
\ No newline at end of file
diff --git a/lib/Stripe/README.md b/lib/Stripe/README.md
index 41c20216..5e703087 100644
--- a/lib/Stripe/README.md
+++ b/lib/Stripe/README.md
@@ -4,6 +4,7 @@
[![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
@@ -85,7 +86,8 @@ Otherwise, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/a
## 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/?lang=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.
@@ -199,6 +201,32 @@ You can disable this behavior if you prefer:
\Stripe\Stripe::setEnableTelemetry(false);
```
+### Beta SDKs
+
+Stripe has features in the beta phase that can be accessed via the beta version of this package.
+We would love for you to try these and share feedback with us before these features reach the stable phase.
+Use the `composer require` command with an exact version specified to install the beta version of the stripe-php pacakge.
+
+
+```bash
+composer require stripe/stripe-php:v9.2.0-beta.1
+```
+
+> **Note**
+> There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific beta version in your composer.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version.
+
+We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
+
+If your beta feature requires a `Stripe-Version` header to be sent, use the `apiVersion` property of `config` object to set it:
+
+```php
+Stripe::setApiVersion(Stripe::getApiVersion() . '; feature_beta=v3');
+```
+
+## Support
+
+New features and bug fixes are released on the latest major version of the Stripe PHP library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
+
## Development
Get [Composer][composer]. For example, on Mac OS:
diff --git a/lib/Stripe/VERSION b/lib/Stripe/VERSION
index f7ee0669..ac718ef1 100644
--- a/lib/Stripe/VERSION
+++ b/lib/Stripe/VERSION
@@ -1 +1 @@
-9.0.0
+10.6.0-beta.1
diff --git a/lib/Stripe/composer.json b/lib/Stripe/composer.json
index dd585a4c..d9ab9adf 100644
--- a/lib/Stripe/composer.json
+++ b/lib/Stripe/composer.json
@@ -24,7 +24,8 @@
"phpunit/phpunit": "^5.7 || ^9.0",
"squizlabs/php_codesniffer": "^3.3",
"friendsofphp/php-cs-fixer": "3.5.0",
- "phpstan/phpstan": "^1.2"
+ "phpstan/phpstan": "^1.2",
+ "php-coveralls/php-coveralls": "^2.5"
},
"autoload": {
"psr-4": {
diff --git a/lib/Stripe/init.php b/lib/Stripe/init.php
index 41fac0f6..5d510be5 100644
--- a/lib/Stripe/init.php
+++ b/lib/Stripe/init.php
@@ -57,6 +57,7 @@
require __DIR__ . '/lib/ApiOperations/Request.php';
require __DIR__ . '/lib/ApiOperations/Retrieve.php';
require __DIR__ . '/lib/ApiOperations/Search.php';
+require __DIR__ . '/lib/ApiOperations/SingletonRetrieve.php';
require __DIR__ . '/lib/ApiOperations/Update.php';
// Plumbing
@@ -79,6 +80,7 @@
// SimplePay\Vendor\Stripe API Resources
require __DIR__ . '/lib/Account.php';
require __DIR__ . '/lib/AccountLink.php';
+require __DIR__ . '/lib/AccountSession.php';
require __DIR__ . '/lib/ApplePayDomain.php';
require __DIR__ . '/lib/ApplicationFee.php';
require __DIR__ . '/lib/ApplicationFeeRefund.php';
@@ -89,6 +91,9 @@
require __DIR__ . '/lib/BillingPortal/Configuration.php';
require __DIR__ . '/lib/BillingPortal/Session.php';
require __DIR__ . '/lib/Capability.php';
+require __DIR__ . '/lib/Capital/FinancingOffer.php';
+require __DIR__ . '/lib/Capital/FinancingSummary.php';
+require __DIR__ . '/lib/Capital/FinancingTransaction.php';
require __DIR__ . '/lib/Card.php';
require __DIR__ . '/lib/CashBalance.php';
require __DIR__ . '/lib/Charge.php';
@@ -100,6 +105,7 @@
require __DIR__ . '/lib/CreditNoteLineItem.php';
require __DIR__ . '/lib/Customer.php';
require __DIR__ . '/lib/CustomerBalanceTransaction.php';
+require __DIR__ . '/lib/CustomerCashBalanceTransaction.php';
require __DIR__ . '/lib/Discount.php';
require __DIR__ . '/lib/Dispute.php';
require __DIR__ . '/lib/EphemeralKey.php';
@@ -111,8 +117,12 @@
require __DIR__ . '/lib/FinancialConnections/Account.php';
require __DIR__ . '/lib/FinancialConnections/AccountOwner.php';
require __DIR__ . '/lib/FinancialConnections/AccountOwnership.php';
+require __DIR__ . '/lib/FinancialConnections/InferredBalance.php';
require __DIR__ . '/lib/FinancialConnections/Session.php';
+require __DIR__ . '/lib/FinancialConnections/Transaction.php';
require __DIR__ . '/lib/FundingInstructions.php';
+require __DIR__ . '/lib/GiftCards/Card.php';
+require __DIR__ . '/lib/GiftCards/Transaction.php';
require __DIR__ . '/lib/Identity/VerificationReport.php';
require __DIR__ . '/lib/Identity/VerificationSession.php';
require __DIR__ . '/lib/Invoice.php';
@@ -138,6 +148,7 @@
require __DIR__ . '/lib/Product.php';
require __DIR__ . '/lib/PromotionCode.php';
require __DIR__ . '/lib/Quote.php';
+require __DIR__ . '/lib/QuotePhase.php';
require __DIR__ . '/lib/Radar/EarlyFraudWarning.php';
require __DIR__ . '/lib/Radar/ValueList.php';
require __DIR__ . '/lib/Radar/ValueListItem.php';
@@ -150,12 +161,15 @@
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';
require __DIR__ . '/lib/SourceTransaction.php';
require __DIR__ . '/lib/Subscription.php';
require __DIR__ . '/lib/SubscriptionItem.php';
require __DIR__ . '/lib/SubscriptionSchedule.php';
+require __DIR__ . '/lib/Tax/Calculation.php';
+require __DIR__ . '/lib/Tax/Registration.php';
+require __DIR__ . '/lib/Tax/Settings.php';
+require __DIR__ . '/lib/Tax/Transaction.php';
require __DIR__ . '/lib/TaxCode.php';
require __DIR__ . '/lib/TaxId.php';
require __DIR__ . '/lib/TaxRate.php';
@@ -186,6 +200,7 @@
// Services
require __DIR__ . '/lib/Service/AccountService.php';
require __DIR__ . '/lib/Service/AccountLinkService.php';
+require __DIR__ . '/lib/Service/AccountSessionService.php';
require __DIR__ . '/lib/Service/ApplePayDomainService.php';
require __DIR__ . '/lib/Service/ApplicationFeeService.php';
require __DIR__ . '/lib/Service/Apps/SecretService.php';
@@ -193,6 +208,9 @@
require __DIR__ . '/lib/Service/BalanceTransactionService.php';
require __DIR__ . '/lib/Service/BillingPortal/ConfigurationService.php';
require __DIR__ . '/lib/Service/BillingPortal/SessionService.php';
+require __DIR__ . '/lib/Service/Capital/FinancingOfferService.php';
+require __DIR__ . '/lib/Service/Capital/FinancingSummaryService.php';
+require __DIR__ . '/lib/Service/Capital/FinancingTransactionService.php';
require __DIR__ . '/lib/Service/ChargeService.php';
require __DIR__ . '/lib/Service/Checkout/SessionService.php';
require __DIR__ . '/lib/Service/CountrySpecService.php';
@@ -207,6 +225,9 @@
require __DIR__ . '/lib/Service/FileLinkService.php';
require __DIR__ . '/lib/Service/FinancialConnections/AccountService.php';
require __DIR__ . '/lib/Service/FinancialConnections/SessionService.php';
+require __DIR__ . '/lib/Service/FinancialConnections/TransactionService.php';
+require __DIR__ . '/lib/Service/GiftCards/CardService.php';
+require __DIR__ . '/lib/Service/GiftCards/TransactionService.php';
require __DIR__ . '/lib/Service/Identity/VerificationReportService.php';
require __DIR__ . '/lib/Service/Identity/VerificationSessionService.php';
require __DIR__ . '/lib/Service/InvoiceService.php';
@@ -227,6 +248,7 @@
require __DIR__ . '/lib/Service/ProductService.php';
require __DIR__ . '/lib/Service/PromotionCodeService.php';
require __DIR__ . '/lib/Service/QuoteService.php';
+require __DIR__ . '/lib/Service/QuotePhaseService.php';
require __DIR__ . '/lib/Service/Radar/EarlyFraudWarningService.php';
require __DIR__ . '/lib/Service/Radar/ValueListService.php';
require __DIR__ . '/lib/Service/Radar/ValueListItemService.php';
@@ -238,11 +260,14 @@
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/Tax/CalculationService.php';
+require __DIR__ . '/lib/Service/Tax/RegistrationService.php';
+require __DIR__ . '/lib/Service/Tax/SettingsService.php';
+require __DIR__ . '/lib/Service/Tax/TransactionService.php';
require __DIR__ . '/lib/Service/TaxCodeService.php';
require __DIR__ . '/lib/Service/TaxRateService.php';
require __DIR__ . '/lib/Service/Terminal/ConfigurationService.php';
@@ -277,14 +302,17 @@
// Service factories
require __DIR__ . '/lib/Service/Apps/AppsServiceFactory.php';
require __DIR__ . '/lib/Service/BillingPortal/BillingPortalServiceFactory.php';
+require __DIR__ . '/lib/Service/Capital/CapitalServiceFactory.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/GiftCards/GiftCardsServiceFactory.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/Tax/TaxServiceFactory.php';
require __DIR__ . '/lib/Service/Terminal/TerminalServiceFactory.php';
require __DIR__ . '/lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php';
require __DIR__ . '/lib/Service/TestHelpers/Terminal/TerminalServiceFactory.php';
diff --git a/lib/Stripe/lib/AccountSession.php b/lib/Stripe/lib/AccountSession.php
new file mode 100644
index 00000000..cd866f98
--- /dev/null
+++ b/lib/Stripe/lib/AccountSession.php
@@ -0,0 +1,30 @@
+Connect
+ * embedded UIs.
+ *
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
+ * @property string $account The ID of the account the AccountSession was created for
+ * @property string $client_secret The client secret of this AccountSession. Used on the client to set up secure access to the given account
.
The client secret can be used to provide access to account
from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.
Refer to our docs to setup Connect embedded UIs and learn about how client_secret
should be handled.
+ * @property int $expires_at The timestamp at which this AccountSession will expire.
+ * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ */
+class AccountSession extends ApiResource
+{
+ const OBJECT_NAME = 'account_session';
+
+ use ApiOperations\Create;
+}
diff --git a/lib/Stripe/lib/AlipayAccount.php b/lib/Stripe/lib/AlipayAccount.php
deleted file mode 100644
index 2358fa38..00000000
--- a/lib/Stripe/lib/AlipayAccount.php
+++ /dev/null
@@ -1,75 +0,0 @@
-refresh();
+
+ return $instance;
+ }
+}
diff --git a/lib/Stripe/lib/ApiOperations/Update.php b/lib/Stripe/lib/ApiOperations/Update.php
index 0c2d4958..e44af801 100644
--- a/lib/Stripe/lib/ApiOperations/Update.php
+++ b/lib/Stripe/lib/ApiOperations/Update.php
@@ -37,6 +37,10 @@ public static function update($id, $params = null, $opts = null)
* @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
*
* @return static the saved resource
+ *
+ * @deprecated The `save` method is deprecated and will be removed in a
+ * future major version of the library. Use the static method `update`
+ * on the resource instead.
*/
public function save($opts = null)
{
diff --git a/lib/Stripe/lib/Apps/Secret.php b/lib/Stripe/lib/Apps/Secret.php
index 67dc5c54..4892deb0 100644
--- a/lib/Stripe/lib/Apps/Secret.php
+++ b/lib/Stripe/lib/Apps/Secret.php
@@ -28,6 +28,7 @@
* @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 Unix timestamp for the expiry time of the secret, after which the secret deletes.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property string $name A name for the secret that's unique within the scope.
* @property null|string $payload The plaintext secret value to be stored.
diff --git a/lib/Stripe/lib/Balance.php b/lib/Stripe/lib/Balance.php
index 6644a6cd..e356fbbd 100644
--- a/lib/Stripe/lib/Balance.php
+++ b/lib/Stripe/lib/Balance.php
@@ -31,15 +31,5 @@ class Balance extends SingletonApiResource
{
const OBJECT_NAME = 'balance';
- /**
- * @param null|array|string $opts
- *
- * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \SimplePay\Vendor\Stripe\Balance
- */
- public static function retrieve($opts = null)
- {
- return self::_singletonRetrieve($opts);
- }
+ use ApiOperations\SingletonRetrieve;
}
diff --git a/lib/Stripe/lib/BillingPortal/Configuration.php b/lib/Stripe/lib/BillingPortal/Configuration.php
index eaf0a137..7be1327a 100644
--- a/lib/Stripe/lib/BillingPortal/Configuration.php
+++ b/lib/Stripe/lib/BillingPortal/Configuration.php
@@ -18,6 +18,7 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $features
* @property bool $is_default Whether the configuration is the default. If true
, 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 true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $login_page
* @property null|\SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
*/
diff --git a/lib/Stripe/lib/BillingPortal/Session.php b/lib/Stripe/lib/BillingPortal/Session.php
index 253cb809..bb089a76 100644
--- a/lib/Stripe/lib/BillingPortal/Session.php
+++ b/lib/Stripe/lib/BillingPortal/Session.php
@@ -27,6 +27,7 @@
* @property string|\SimplePay\Vendor\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 null|\SimplePay\Vendor\Stripe\StripeObject $flow Information about a specific flow for the customer to go through.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|string $locale The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer’s preferred_locales
or browser’s 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 on_behalf_of
account appear in the portal. For more information, see the docs. Use the Accounts API to modify the on_behalf_of
account's branding settings, which the portal displays.
diff --git a/lib/Stripe/lib/Capital/FinancingOffer.php b/lib/Stripe/lib/Capital/FinancingOffer.php
new file mode 100644
index 00000000..4824eb25
--- /dev/null
+++ b/lib/Stripe/lib/Capital/FinancingOffer.php
@@ -0,0 +1,70 @@
+true if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $offered_terms This is an object representing the terms of an offer of financing from SimplePay\Vendor\Stripe Capital to a Connected account. This resource represents both the terms offered to the Connected account.
+ * @property string $product_type Financing product identifier.
+ * @property string $replacement The ID of the financing offer that replaced this offer.
+ * @property string $replacement_for The ID of the financing offer that this offer is a replacement for.
+ * @property string $status The current status of the offer.
+ * @property string $type See financing_type.
+ */
+class FinancingOffer extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'capital.financing_offer';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\All;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Retrieve;
+
+ const FINANCING_TYPE_CASH_ADVANCE = 'cash_advance';
+ const FINANCING_TYPE_FLEX_LOAN = 'flex_loan';
+
+ const PRODUCT_TYPE_REFILL = 'refill';
+ const PRODUCT_TYPE_STANDARD = 'standard';
+
+ const STATUS_ACCEPTED = 'accepted';
+ const STATUS_CANCELED = 'canceled';
+ const STATUS_COMPLETED = 'completed';
+ const STATUS_DELIVERED = 'delivered';
+ const STATUS_EXPIRED = 'expired';
+ const STATUS_FULLY_REPAID = 'fully_repaid';
+ const STATUS_PAID_OUT = 'paid_out';
+ const STATUS_REJECTED = 'rejected';
+ const STATUS_REPLACED = 'replaced';
+ const STATUS_UNDELIVERED = 'undelivered';
+
+ const TYPE_CASH_ADVANCE = 'cash_advance';
+ const TYPE_FLEX_LOAN = 'flex_loan';
+
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Capital\FinancingOffer the marked financing offer
+ */
+ public function markDelivered($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/mark_delivered';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
+}
diff --git a/lib/Stripe/lib/Capital/FinancingSummary.php b/lib/Stripe/lib/Capital/FinancingSummary.php
new file mode 100644
index 00000000..4d2819b8
--- /dev/null
+++ b/lib/Stripe/lib/Capital/FinancingSummary.php
@@ -0,0 +1,25 @@
+/v1/capital/financing_summary will only return details
for paid_out
financing.
+ */
+class FinancingSummary extends \SimplePay\Vendor\Stripe\SingletonApiResource
+{
+ const OBJECT_NAME = 'capital.financing_summary';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\SingletonRetrieve;
+
+ const STATUS_ACCEPTED = 'accepted';
+ const STATUS_DELIVERED = 'delivered';
+ const STATUS_NONE = 'none';
+}
diff --git a/lib/Stripe/lib/Capital/FinancingTransaction.php b/lib/Stripe/lib/Capital/FinancingTransaction.php
new file mode 100644
index 00000000..631f1e99
--- /dev/null
+++ b/lib/Stripe/lib/Capital/FinancingTransaction.php
@@ -0,0 +1,32 @@
+true if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property string $type The type of the financing transaction.
+ * @property null|string $user_facing_description A human-friendly description of the financing transaction.
+ */
+class FinancingTransaction extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'capital.financing_transaction';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\All;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Retrieve;
+
+ const TYPE_PAYMENT = 'payment';
+ const TYPE_PAYOUT = 'payout';
+ const TYPE_REVERSAL = 'reversal';
+}
diff --git a/lib/Stripe/lib/Charge.php b/lib/Stripe/lib/Charge.php
index 6fd6f22d..e1f3e72b 100644
--- a/lib/Stripe/lib/Charge.php
+++ b/lib/Stripe/lib/Charge.php
@@ -35,7 +35,7 @@
* @property null|string|\SimplePay\Vendor\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|\SimplePay\Vendor\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 the errors section for a list of codes).
+ * @property null|string $failure_code Error code explaining reason for charge failure if available (see the errors section for a list of codes).
* @property null|string $failure_message Message to user further explaining reason for charge failure if available.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $fraud_details Information on fraud assessments for the charge.
* @property null|string|\SimplePay\Vendor\Stripe\Invoice $invoice ID of the invoice this charge is for if one exists.
@@ -53,7 +53,7 @@
* @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this charge. This attribute will be null
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 \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Refund> $refunds A list of refunds that have been applied to the charge.
+ * @property null|\SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Refund> $refunds A list of refunds that have been applied to the charge.
* @property null|string|\SimplePay\Vendor\Stripe\Review $review ID of the review associated with this charge if one exists.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $shipping Shipping information for the charge.
* @property null|\SimplePay\Vendor\Stripe\Account|\SimplePay\Vendor\Stripe\BankAccount|\SimplePay\Vendor\Stripe\Card|\SimplePay\Vendor\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 payment_method
or payment_method_details
instead.
diff --git a/lib/Stripe/lib/Checkout/Session.php b/lib/Stripe/lib/Checkout/Session.php
index d34cff8c..d9babffb 100644
--- a/lib/Stripe/lib/Checkout/Session.php
+++ b/lib/Stripe/lib/Checkout/Session.php
@@ -20,8 +20,8 @@
* You can create a Checkout Session on your server and pass its ID to the client
* to begin Checkout.
*
- * Related guide: Checkout
- * Server Quickstart.
+ * Related guide: Checkout
+ * Quickstart.
*
* @property string $id Unique identifier for the object. Used to pass to redirectToCheckout
in Stripe.js.
* @property string $object String representing the object's type. Objects of the same type share the same value.
@@ -31,16 +31,20 @@
* @property null|int $amount_total Total of all items after discounts and taxes are applied.
* @property \SimplePay\Vendor\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 $cancel_url If set, Checkout displays a back button and customers will be directed to this URL 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|\SimplePay\Vendor\Stripe\StripeObject $consent Results of consent_collection
for this session.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $consent_collection When set, provides configuration for the Checkout Session to gather active consent from customers.
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $custom_text
* @property null|string|\SimplePay\Vendor\Stripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in payment
or subscription
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|\SimplePay\Vendor\Stripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in setup
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 customer
attribute.
* @property int $expires_at The timestamp at which the Checkout Session will expire.
+ * @property null|string|\SimplePay\Vendor\Stripe\Invoice $invoice ID of the invoice created by the Checkout Session, if it exists.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $invoice_creation Details on the state of invoice creation for the Checkout Session.
* @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> $line_items The line items purchased by the customer.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or auto
, the browser's locale is used.
@@ -48,6 +52,7 @@
* @property string $mode The mode of the Checkout Session.
* @property null|string|\SimplePay\Vendor\Stripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in payment
mode.
* @property null|string|\SimplePay\Vendor\Stripe\PaymentLink $payment_link The ID of the Payment Link that created this Session.
+ * @property null|string $payment_method_collection Configure whether a Checkout Session should collect a payment method.
* @property null|\SimplePay\Vendor\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 paid
, unpaid
, or no_payment_required
. You can use this value to decide when to fulfill your customer's order.
@@ -64,7 +69,7 @@
* @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful.
* @property \SimplePay\Vendor\Stripe\StripeObject $tax_id_collection
* @property null|\SimplePay\Vendor\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 you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll use checkout.stripe.com.
+ * @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll use checkout.stripe.com.
This value is only present when the session is active.
*/
class Session extends \SimplePay\Vendor\Stripe\ApiResource
{
@@ -84,6 +89,9 @@ class Session extends \SimplePay\Vendor\Stripe\ApiResource
const MODE_SETUP = 'setup';
const MODE_SUBSCRIPTION = 'subscription';
+ const PAYMENT_METHOD_COLLECTION_ALWAYS = 'always';
+ const PAYMENT_METHOD_COLLECTION_IF_REQUIRED = 'if_required';
+
const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required';
const PAYMENT_STATUS_PAID = 'paid';
const PAYMENT_STATUS_UNPAID = 'unpaid';
diff --git a/lib/Stripe/lib/CreditNote.php b/lib/Stripe/lib/CreditNote.php
index 1d878a09..54005968 100644
--- a/lib/Stripe/lib/CreditNote.php
+++ b/lib/Stripe/lib/CreditNote.php
@@ -14,6 +14,7 @@
* @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 %s representing the total amount of the credit note, including tax.
+ * @property int $amount_shipping This is the sum of all the shipping amounts.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property string|\SimplePay\Vendor\Stripe\Customer $customer ID of the customer.
@@ -30,6 +31,7 @@
* @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 duplicate
, fraudulent
, order_change
, or product_unsatisfactory
* @property null|string|\SimplePay\Vendor\Stripe\Refund $refund Refund related to this credit note.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $shipping_cost The details of the cost of shipping, including the ShippingRate applied to the invoice.
* @property string $status Status of this credit note, one of issued
or void
. Learn more about voiding credit notes.
* @property int $subtotal The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
* @property null|int $subtotal_excluding_tax The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts.
diff --git a/lib/Stripe/lib/Customer.php b/lib/Stripe/lib/Customer.php
index 79e93cd5..fd6a4222 100644
--- a/lib/Stripe/lib/Customer.php
+++ b/lib/Stripe/lib/Customer.php
@@ -16,7 +16,7 @@
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\SimplePay\Vendor\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|\SimplePay\Vendor\Stripe\CashBalance $cash_balance The current funds being held by SimplePay\Vendor\Stripe on behalf of the customer. These funds can be applied towards payment intents with source "cash_balance".The settings[reconciliation_mode] field describes whether these funds are applied to such payment intents manually or automatically.
+ * @property null|\SimplePay\Vendor\Stripe\CashBalance $cash_balance The current funds being held by SimplePay\Vendor\Stripe on behalf of the customer. These funds can be applied towards payment intents with source "cash_balance". 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 ISO code for the currency the customer can be charged in for recurring billing purposes.
* @property null|string|\SimplePay\Vendor\Stripe\Account|\SimplePay\Vendor\Stripe\BankAccount|\SimplePay\Vendor\Stripe\Card|\SimplePay\Vendor\Stripe\Source $default_source ID of the default payment source for the customer.
If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method field instead.
@@ -24,7 +24,7 @@
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|\SimplePay\Vendor\Stripe\Discount $discount Describes the current discount active on the customer, if there is one.
* @property null|string $email The customer's email address.
- * @property \SimplePay\Vendor\Stripe\StripeObject $invoice_credit_balance The current multi-currency balances, if any, being stored on the customer.If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency.If negative, the customer has an amount owed that will be added to their next invoice denominated in that currency. These balances do not refer to any unpaid invoices.They solely track amounts that have yet to be successfully applied to any invoice. A balance in a particular currency is only applied to any invoice as an invoice in that currency is finalized.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $invoice_credit_balance The current multi-currency balances, if any, being stored on the customer. If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency. If negative, the customer has an amount owed that will be added to their next invoice denominated in that currency. These balances do not refer to any unpaid invoices. They solely track amounts that have yet to be successfully applied to any invoice. A balance in a particular currency is only applied to any invoice as an invoice in that currency is finalized.
* @property null|string $invoice_prefix The prefix for the customer used to generate unique invoice numbers.
* @property \SimplePay\Vendor\Stripe\StripeObject $invoice_settings
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
@@ -227,6 +227,36 @@ public static function updateBalanceTransaction($id, $balanceTransactionId, $par
{
return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
}
+ const PATH_CASH_BALANCE_TRANSACTIONS = '/cash_balance_transactions';
+
+ /**
+ * @param string $id the ID of the customer on which to retrieve the customer cash balance transactions
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\CustomerCashBalanceTransaction> the list of customer cash balance transactions
+ */
+ public static function allCashBalanceTransactions($id, $params = null, $opts = null)
+ {
+ return self::_allNestedResources($id, static::PATH_CASH_BALANCE_TRANSACTIONS, $params, $opts);
+ }
+
+ /**
+ * @param string $id the ID of the customer to which the customer cash balance transaction belongs
+ * @param string $cashBalanceTransactionId the ID of the customer cash balance transaction to retrieve
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\CustomerCashBalanceTransaction
+ */
+ public static function retrieveCashBalanceTransaction($id, $cashBalanceTransactionId, $params = null, $opts = null)
+ {
+ return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE_TRANSACTIONS, $cashBalanceTransactionId, $params, $opts);
+ }
const PATH_SOURCES = '/sources';
/**
diff --git a/lib/Stripe/lib/CustomerBalanceTransaction.php b/lib/Stripe/lib/CustomerBalanceTransaction.php
index bc73ed70..a6a3b740 100644
--- a/lib/Stripe/lib/CustomerBalanceTransaction.php
+++ b/lib/Stripe/lib/CustomerBalanceTransaction.php
@@ -29,7 +29,7 @@
* @property null|string|\SimplePay\Vendor\Stripe\Invoice $invoice The ID of the invoice (if any) related to the transaction.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
- * @property string $type Transaction type: adjustment
, applied_to_invoice
, credit_note
, initial
, invoice_too_large
, invoice_too_small
, unspent_receiver_credit
, or unapplied_from_invoice
. See the Customer Balance page to learn more about transaction types.
+ * @property string $type Transaction type: adjustment
, applied_to_invoice
, credit_note
, initial
, invoice_overpaid
, invoice_too_large
, invoice_too_small
, unspent_receiver_credit
, or unapplied_from_invoice
. See the Customer Balance page to learn more about transaction types.
*/
class CustomerBalanceTransaction extends ApiResource
{
@@ -39,6 +39,7 @@ class CustomerBalanceTransaction extends ApiResource
const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice';
const TYPE_CREDIT_NOTE = 'credit_note';
const TYPE_INITIAL = 'initial';
+ const TYPE_INVOICE_OVERPAID = 'invoice_overpaid';
const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large';
const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small';
const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit';
diff --git a/lib/Stripe/lib/CustomerCashBalanceTransaction.php b/lib/Stripe/lib/CustomerCashBalanceTransaction.php
new file mode 100644
index 00000000..398bb311
--- /dev/null
+++ b/lib/Stripe/lib/CustomerCashBalanceTransaction.php
@@ -0,0 +1,42 @@
+ISO currency code, in lowercase. Must be a supported currency.
+ * @property string|\SimplePay\Vendor\Stripe\Customer $customer The customer whose available cash balance changed as a result of this transaction.
+ * @property int $ending_balance The total available cash balance for the specified currency after this transaction was applied. Represented in the smallest currency unit.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $funded
+ * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property int $net_amount The amount by which the cash balance changed, represented in the smallest currency unit. A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $refunded_from_payment
+ * @property string $type The type of the cash balance transaction. One of applied_to_payment
, unapplied_from_payment
, refunded_from_payment
, funded
, return_initiated
, or return_canceled
. New types may be added in future. See Customer Balance to learn more about these types.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $unapplied_from_payment
+ */
+class CustomerCashBalanceTransaction extends ApiResource
+{
+ const OBJECT_NAME = 'customer_cash_balance_transaction';
+
+ use ApiOperations\All;
+ use ApiOperations\Retrieve;
+
+ const TYPE_APPLIED_TO_PAYMENT = 'applied_to_payment';
+ const TYPE_FUNDED = 'funded';
+ const TYPE_FUNDING_REVERSED = 'funding_reversed';
+ const TYPE_REFUNDED_FROM_PAYMENT = 'refunded_from_payment';
+ const TYPE_RETURN_CANCELED = 'return_canceled';
+ const TYPE_RETURN_INITIATED = 'return_initiated';
+ const TYPE_UNAPPLIED_FROM_PAYMENT = 'unapplied_from_payment';
+}
diff --git a/lib/Stripe/lib/ErrorObject.php b/lib/Stripe/lib/ErrorObject.php
index 6bdf563c..b883233d 100644
--- a/lib/Stripe/lib/ErrorObject.php
+++ b/lib/Stripe/lib/ErrorObject.php
@@ -26,6 +26,8 @@
* @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 string $request_log_url A URL to the request log entry in your
+ * dashboard.
* @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
diff --git a/lib/Stripe/lib/Event.php b/lib/Stripe/lib/Event.php
index 8882c6d2..683273bc 100644
--- a/lib/Stripe/lib/Event.php
+++ b/lib/Stripe/lib/Event.php
@@ -74,6 +74,7 @@ class Event extends ApiResource
const BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated';
const BILLING_PORTAL_SESSION_CREATED = 'billing_portal.session.created';
const CAPABILITY_UPDATED = 'capability.updated';
+ const CAPITAL_FINANCING_TRANSACTION_CREATED = 'capital.financing_transaction.created';
const CASH_BALANCE_FUNDS_AVAILABLE = 'cash_balance.funds_available';
const CHARGE_CAPTURED = 'charge.captured';
const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed';
@@ -109,20 +110,27 @@ 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_PAUSED = 'customer.subscription.paused';
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_RESUMED = 'customer.subscription.resumed';
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 CUSTOMER_CASH_BALANCE_TRANSACTION_CREATED = 'customer_cash_balance_transaction.created';
const FILE_CREATED = 'file.created';
const FINANCIAL_CONNECTIONS_ACCOUNT_CREATED = 'financial_connections.account.created';
const FINANCIAL_CONNECTIONS_ACCOUNT_DEACTIVATED = 'financial_connections.account.deactivated';
const FINANCIAL_CONNECTIONS_ACCOUNT_DISCONNECTED = 'financial_connections.account.disconnected';
const FINANCIAL_CONNECTIONS_ACCOUNT_REACTIVATED = 'financial_connections.account.reactivated';
const FINANCIAL_CONNECTIONS_ACCOUNT_REFRESHED_BALANCE = 'financial_connections.account.refreshed_balance';
+ const FINANCIAL_CONNECTIONS_ACCOUNT_REFRESHED_INFERRED_BALANCES = 'financial_connections.account.refreshed_inferred_balances';
+ const FINANCIAL_CONNECTIONS_ACCOUNT_REFRESHED_OWNERSHIP = 'financial_connections.account.refreshed_ownership';
+ const FINANCIAL_CONNECTIONS_ACCOUNT_REFRESHED_TRANSACTIONS = 'financial_connections.account.refreshed_transactions';
+ const FINANCIAL_CONNECTIONS_SESSION_UPDATED = 'financial_connections.session.updated';
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';
@@ -195,14 +203,20 @@ class Event extends ApiResource
const PROMOTION_CODE_CREATED = 'promotion_code.created';
const PROMOTION_CODE_UPDATED = 'promotion_code.updated';
const QUOTE_ACCEPTED = 'quote.accepted';
+ const QUOTE_ACCEPTING = 'quote.accepting';
const QUOTE_CANCELED = 'quote.canceled';
const QUOTE_CREATED = 'quote.created';
+ const QUOTE_DRAFT = 'quote.draft';
const QUOTE_FINALIZED = 'quote.finalized';
+ const QUOTE_REESTIMATED = 'quote.reestimated';
+ const QUOTE_STALE = 'quote.stale';
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';
+ const REFUND_CREATED = 'refund.created';
+ const REFUND_UPDATED = 'refund.updated';
const REPORTING_REPORT_RUN_FAILED = 'reporting.report_run.failed';
const REPORTING_REPORT_RUN_SUCCEEDED = 'reporting.report_run.succeeded';
const REPORTING_REPORT_TYPE_UPDATED = 'reporting.report_type.updated';
diff --git a/lib/Stripe/lib/File.php b/lib/Stripe/lib/File.php
index 7f510077..74002ade 100644
--- a/lib/Stripe/lib/File.php
+++ b/lib/Stripe/lib/File.php
@@ -48,6 +48,7 @@ class File extends ApiResource
const PURPOSE_SELFIE = 'selfie';
const PURPOSE_SIGMA_SCHEDULED_QUERY = 'sigma_scheduled_query';
const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload';
+ const PURPOSE_TERMINAL_READER_SPLASHSCREEN = 'terminal_reader_splashscreen';
// This resource can have two different object names. In latter API
// versions, only `file` is used, but since stripe-php may be used with
diff --git a/lib/Stripe/lib/FinancialConnections/Account.php b/lib/Stripe/lib/FinancialConnections/Account.php
index 35785f09..311029e6 100644
--- a/lib/Stripe/lib/FinancialConnections/Account.php
+++ b/lib/Stripe/lib/FinancialConnections/Account.php
@@ -16,6 +16,7 @@
* @property string $category The type of the account. Account category is further divided in subcategory
.
* @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 null|\SimplePay\Vendor\Stripe\StripeObject $inferred_balances_refresh The state of the most recent attempt to refresh the account's inferred balance history.
* @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 true
if the object exists in live mode or the value false
if the object exists in test mode.
@@ -24,13 +25,16 @@
* @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 If category
is cash
, one of:
- checking
- savings
- other
If category
is credit
, one of:
- mortgage
- line_of_credit
- credit_card
- other
If category
is investment
or other
, this will be other
.
+ * @property null|string[] $subscriptions The list of data refresh subscriptions requested on this account.
* @property string[] $supported_payment_method_types The PaymentMethod type(s) that can be created from this account.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $transaction_refresh The state of the most recent attempt to refresh the account transactions.
*/
class Account extends \SimplePay\Vendor\Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.account';
use \SimplePay\Vendor\Stripe\ApiOperations\All;
+ use \SimplePay\Vendor\Stripe\ApiOperations\NestedResource;
use \SimplePay\Vendor\Stripe\ApiOperations\Retrieve;
const CATEGORY_CASH = 'cash';
@@ -101,4 +105,20 @@ public function refreshAccount($params = null, $opts = null)
return $this;
}
+
+ const PATH_INFERRED_BALANCES = '/inferred_balances';
+
+ /**
+ * @param string $id the ID of the account on which to retrieve the financial connections account inferred balances
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\FinancialConnections\FinancialConnectionsAccountInferredBalance> the list of financial connections account inferred balances
+ */
+ public static function allInferredBalances($id, $params = null, $opts = null)
+ {
+ return self::_allNestedResources($id, static::PATH_INFERRED_BALANCES, $params, $opts);
+ }
}
diff --git a/lib/Stripe/lib/FinancialConnections/InferredBalance.php b/lib/Stripe/lib/FinancialConnections/InferredBalance.php
new file mode 100644
index 00000000..7fa470e3
--- /dev/null
+++ b/lib/Stripe/lib/FinancialConnections/InferredBalance.php
@@ -0,0 +1,22 @@
+The balances owed to (or by) the account holder.Each key is a three-letter ISO currency code, in lowercase.
Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder.
+ */
+class InferredBalance extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'financial_connections.account_inferred_balance';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\All;
+}
diff --git a/lib/Stripe/lib/FinancialConnections/Session.php b/lib/Stripe/lib/FinancialConnections/Session.php
index a31ff1e8..e8d899c5 100644
--- a/lib/Stripe/lib/FinancialConnections/Session.php
+++ b/lib/Stripe/lib/FinancialConnections/Session.php
@@ -15,8 +15,12 @@
* @property string $client_secret A value that will be passed to the client to launch the authentication flow.
* @property \SimplePay\Vendor\Stripe\StripeObject $filters
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $manual_entry
* @property string[] $permissions Permissions requested for accounts collected during this session.
+ * @property null|string[] $prefetch Data features requested to be retrieved upon account creation.
* @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.
+ * @property string $status The current state of the session.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $status_details
*/
class Session extends \SimplePay\Vendor\Stripe\ApiResource
{
@@ -24,4 +28,9 @@ class Session extends \SimplePay\Vendor\Stripe\ApiResource
use \SimplePay\Vendor\Stripe\ApiOperations\Create;
use \SimplePay\Vendor\Stripe\ApiOperations\Retrieve;
+
+ const STATUS_CANCELLED = 'cancelled';
+ const STATUS_FAILED = 'failed';
+ const STATUS_PENDING = 'pending';
+ const STATUS_SUCCEEDED = 'succeeded';
}
diff --git a/lib/Stripe/lib/FinancialConnections/Transaction.php b/lib/Stripe/lib/FinancialConnections/Transaction.php
new file mode 100644
index 00000000..ff042d5e
--- /dev/null
+++ b/lib/Stripe/lib/FinancialConnections/Transaction.php
@@ -0,0 +1,33 @@
+ISO currency code, in lowercase. Must be a supported currency.
+ * @property string $description The description of this transaction.
+ * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property string $status The status of the transaction.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $status_transitions
+ * @property int $transacted_at Time at which the transaction was transacted. Measured in seconds since the Unix epoch.
+ * @property string $transaction_refresh The transaction_refresh object that last updated or created this transaction.
+ * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
+ */
+class Transaction extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'financial_connections.transaction';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\All;
+
+ const STATUS_PENDING = 'pending';
+ const STATUS_POSTED = 'posted';
+ const STATUS_VOID = 'void';
+}
diff --git a/lib/Stripe/lib/GiftCards/Card.php b/lib/Stripe/lib/GiftCards/Card.php
new file mode 100644
index 00000000..51c2722f
--- /dev/null
+++ b/lib/Stripe/lib/GiftCards/Card.php
@@ -0,0 +1,49 @@
+ISO currency code, in lowercase. Must be a supported currency.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\GiftCards\Transaction> $transactions Transactions on this gift card.
+ */
+class Card extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'gift_cards.card';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\All;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Create;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Retrieve;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Update;
+
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Card the validated card
+ */
+ public static function validate($params = null, $opts = null)
+ {
+ $url = static::classUrl() . '/validate';
+ list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
+ $obj = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+}
diff --git a/lib/Stripe/lib/GiftCards/Transaction.php b/lib/Stripe/lib/GiftCards/Transaction.php
new file mode 100644
index 00000000..670d5c8c
--- /dev/null
+++ b/lib/Stripe/lib/GiftCards/Transaction.php
@@ -0,0 +1,77 @@
+confirmed,
+ * held
or canceled
. A confirmed
transaction
+ * is one that has added/deducted funds. A held
transaction has
+ * created a temporary hold on funds, which can then be cancelled or confirmed. A
+ * held
transaction can be confirmed into a confirmed
+ * transaction, or canceled into a canceled
transaction. A
+ * canceled
transaction has no effect on a gift card's balance.
+ *
+ * @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 The amount of this transaction. A positive value indicates that funds were added to the gift card. A negative value indicates that funds were removed from the gift card.
+ * @property null|int $confirmed_at Time at which the transaction was confirmed. Measured in seconds since the Unix epoch.
+ * @property null|int $created Time at which the object was created. Measured in seconds since the Unix epoch.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $created_by The related SimplePay\Vendor\Stripe objects that created this gift card transaction.
+ * @property null|string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
+ * @property null|string $gift_card The gift card that this transaction occurred on
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property null|string $status Status of this transaction, one of held
, confirmed
, or canceled
.
+ * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the Connect documentation for details.
+ */
+class Transaction extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'gift_cards.transaction';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\All;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Create;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Retrieve;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Update;
+
+ const STATUS_CANCELED = 'canceled';
+ const STATUS_CONFIRMED = 'confirmed';
+ const STATUS_HELD = 'held';
+ const STATUS_INVALID = 'invalid';
+
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Transaction the canceled transaction
+ */
+ 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 \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Transaction the confirmed transaction
+ */
+ public function confirm($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/confirm';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
+}
diff --git a/lib/Stripe/lib/Identity/VerificationSession.php b/lib/Stripe/lib/Identity/VerificationSession.php
index 0f8704bd..587c5733 100644
--- a/lib/Stripe/lib/Identity/VerificationSession.php
+++ b/lib/Stripe/lib/Identity/VerificationSession.php
@@ -14,7 +14,7 @@
* A VerificationSession transitions through multiple statuses throughout its
* lifetime as it progresses through the verification flow. The VerificationSession
- * contains the user’s verified data after verification checks are complete.
+ * contains the user's verified data after verification checks are complete.
*
* Related guide: The Verification
diff --git a/lib/Stripe/lib/Invoice.php b/lib/Stripe/lib/Invoice.php
index 1ad3c86e..7c1dcabc 100644
--- a/lib/Stripe/lib/Invoice.php
+++ b/lib/Stripe/lib/Invoice.php
@@ -41,7 +41,7 @@
* Related guide: Send
* Invoices to Customers.
*
- * @property string $id Unique identifier for the object.
+ * @property string $id Unique identifier for the object. This property is always present unless the invoice is an upcoming invoice. See Retrieve an upcoming invoice for more details.
* @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.
@@ -49,8 +49,10 @@
* @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 amount_due
may be 0. If there is a positive starting_balance
for the invoice (the customer owes money), the amount_due
will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due
.
* @property int $amount_paid The amount, in %s, that was paid.
* @property int $amount_remaining The difference between amount_due and amount_paid, in %s.
+ * @property int $amount_shipping This is the sum of all the shipping amounts.
* @property null|string|\SimplePay\Vendor\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 SimplePay\Vendor\Stripe account when the invoice is paid.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $applies_to
* @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 invoice.created
webhook, for example, so you might not want to display that invoice as unpaid to your users.
* @property bool $auto_advance Controls whether SimplePay\Vendor\Stripe will perform automatic collection of the invoice. When false
, the invoice's state will not automatically advance without an explicit action.
@@ -78,9 +80,11 @@
* @property null|int $due_date The date on which payment for this invoice is due. This value will be null
for invoices where collection_method=charge_automatically
.
* @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|\SimplePay\Vendor\Stripe\StripeObject $from_invoice Details of the invoice that was cloned. See the revision documentation for more details.
* @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 null|\SimplePay\Vendor\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 null|\SimplePay\Vendor\Stripe\StripeObject $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 null|string|\SimplePay\Vendor\Stripe\Invoice $latest_revision The ID of the most recent non-draft revision of this invoice
* @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\InvoiceLineItem> $lines The individual line items that make up the invoice. lines
is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
@@ -98,7 +102,9 @@
* @property null|string|\SimplePay\Vendor\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 null|\SimplePay\Vendor\Stripe\StripeObject $rendering_options Options for invoice PDF rendering.
- * @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|\SimplePay\Vendor\Stripe\StripeObject $shipping_cost The details of the cost of shipping, including the ShippingRate applied on the invoice.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $shipping_details Shipping details for the invoice. The Invoice PDF will use the shipping_details
value if it is set, otherwise the PDF will render the shipping address from the customer.
+ * @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. For revision invoices, this also includes any customer balance that was applied to the original invoice.
* @property null|string $statement_descriptor Extra information about an invoice for the customer's credit card statement.
* @property null|string $status The status of the invoice, one of draft
, open
, paid
, uncollectible
, or void
. Learn more
* @property \SimplePay\Vendor\Stripe\StripeObject $status_transitions
diff --git a/lib/Stripe/lib/InvoiceLineItem.php b/lib/Stripe/lib/InvoiceLineItem.php
index d2b01973..159dade6 100644
--- a/lib/Stripe/lib/InvoiceLineItem.php
+++ b/lib/Stripe/lib/InvoiceLineItem.php
@@ -9,6 +9,7 @@
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount The amount, in %s.
* @property null|int $amount_excluding_tax The integer amount in %s representing the amount for this line item, excluding all tax and discounts.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $applies_to
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|\SimplePay\Vendor\Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item.
diff --git a/lib/Stripe/lib/Issuing/Authorization.php b/lib/Stripe/lib/Issuing/Authorization.php
index cda82d60..977db8eb 100644
--- a/lib/Stripe/lib/Issuing/Authorization.php
+++ b/lib/Stripe/lib/Issuing/Authorization.php
@@ -30,13 +30,14 @@
* @property string $merchant_currency The currency that was presented to the cardholder for the authorization. Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property \SimplePay\Vendor\Stripe\StripeObject $merchant_data
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $network_data Details about the authorization, such as identifiers, set by the card network.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $pending_request The pending authorization request. This field will only be non-null during an issuing_authorization.request
webhook.
- * @property \SimplePay\Vendor\Stripe\StripeObject[] $request_history History of every time pending_request
was approved/denied, either by you directly or by SimplePay\Vendor\Stripe (e.g. based on your spending_controls
). If the merchant changes the authorization by performing an incremental authorization, you can look at this field to see the previous requests for the authorization.
+ * @property \SimplePay\Vendor\Stripe\StripeObject[] $request_history History of every time a pending_request
authorization was approved/declined, either by you directly or by SimplePay\Vendor\Stripe (e.g. based on your spending_controls). If the merchant changes the authorization by performing an incremental authorization, you can look at this field to see the previous requests for the authorization. This field can be helpful in determining why a given authorization was approved/declined.
* @property string $status The current status of the authorization in its lifecycle.
* @property \SimplePay\Vendor\Stripe\Issuing\Transaction[] $transactions List of transactions associated with this authorization.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $treasury Treasury details related to this authorization if it was created on a FinancialAccount.
* @property \SimplePay\Vendor\Stripe\StripeObject $verification_data
- * @property null|string $wallet The digital wallet used for this authorization. One of apple_pay
, google_pay
, or samsung_pay
.
+ * @property null|string $wallet The digital wallet used for this transaction. One of apple_pay
, google_pay
, or samsung_pay
. Will populate as null
when no digital wallet was utilized.
*/
class Authorization extends \SimplePay\Vendor\Stripe\ApiResource
{
diff --git a/lib/Stripe/lib/Issuing/Transaction.php b/lib/Stripe/lib/Issuing/Transaction.php
index a05f0b7e..c4de2a68 100644
--- a/lib/Stripe/lib/Issuing/Transaction.php
+++ b/lib/Stripe/lib/Issuing/Transaction.php
@@ -30,6 +30,7 @@
* @property string $merchant_currency The currency with which the merchant is taking payment.
* @property \SimplePay\Vendor\Stripe\StripeObject $merchant_data
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $network_data Details about the transaction, such as processing dates, set by the card network.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $purchase_details Additional purchase information that is optionally provided by the merchant.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $treasury Treasury details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts
* @property string $type The nature of the transaction.
diff --git a/lib/Stripe/lib/Order.php b/lib/Stripe/lib/Order.php
index 3ce7db70..8587e1c4 100644
--- a/lib/Stripe/lib/Order.php
+++ b/lib/Stripe/lib/Order.php
@@ -13,6 +13,7 @@
*
* @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_remaining
* @property int $amount_subtotal Order cost before any discounts or taxes are applied. A positive integer representing the subtotal of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
* @property int $amount_total Total order cost after discounts and taxes are applied. A positive integer representing the cost of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). To submit an order, the total must be either 0 or at least $0.50 USD or equivalent in charge currency.
* @property null|string|\SimplePay\Vendor\Stripe\StripeObject $application ID of the Connect application that created the Order, if any.
@@ -20,6 +21,7 @@
* @property null|\SimplePay\Vendor\Stripe\StripeObject $billing_details Customer billing details associated with the order.
* @property null|string $client_secret The client secret of this Order. Used for client-side retrieval using a publishable key.
The client secret can be used to complete a payment for an Order 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.
Refer to our docs for creating and processing an order to learn about how client_secret should be handled.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
+ * @property \SimplePay\Vendor\Stripe\StripeObject[] $credits The credits applied to the Order. At most 10 credits can be applied to an Order.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property null|string|\SimplePay\Vendor\Stripe\Customer $customer The customer which this orders belongs to.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
diff --git a/lib/Stripe/lib/PaymentIntent.php b/lib/Stripe/lib/PaymentIntent.php
index 6298d510..0d0390f1 100644
--- a/lib/Stripe/lib/PaymentIntent.php
+++ b/lib/Stripe/lib/PaymentIntent.php
@@ -30,7 +30,6 @@
* @property null|int $canceled_at Populated when status
is canceled
, 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 (duplicate
, fraudulent
, requested_by_customer
, or abandoned
) or generated by SimplePay\Vendor\Stripe internally (failed_invoice
, void_invoice
, or automatic
).
* @property string $capture_method Controls when the funds will be captured from the customer's account.
- * @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Charge> $charges Charges that were created by this PaymentIntent, if any.
* @property null|string $client_secret The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.
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.
Refer to our docs to accept a payment and learn about how client_secret
should be handled.
* @property string $confirmation_method
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
@@ -38,7 +37,8 @@
* @property null|string|\SimplePay\Vendor\Stripe\Customer $customer ID of the Customer this PaymentIntent belongs to, if one exists.
Payment methods attached to other Customers cannot be used with this PaymentIntent.
If present in combination with setup_future_usage, this PaymentIntent's payment method will be attached to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|string|\SimplePay\Vendor\Stripe\Invoice $invoice ID of the invoice that created this PaymentIntent, if it exists.
- * @property null|\SimplePay\Vendor\Stripe\ErrorObject $last_payment_error The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $last_payment_error The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason.
+ * @property null|string|\SimplePay\Vendor\Stripe\Charge $latest_charge The latest charge created by this payment intent.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. For more information, see the documentation.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source.
@@ -49,6 +49,7 @@
* @property null|\SimplePay\Vendor\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 receipt_email
is specified for a payment in live mode, a receipt will be sent regardless of your email settings.
* @property null|string|\SimplePay\Vendor\Stripe\Review $review ID of the review associated with this PaymentIntent, if any.
+ * @property string $secret_key_confirmation Indicates whether confirmation for this PaymentIntent using a secret key is required
or optional
.
* @property null|string $setup_future_usage Indicates that you intend to make future payments with this PaymentIntent's payment method.
Providing this parameter will attach the payment method 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 attached to a Customer after the transaction completes.
When processing card payments, SimplePay\Vendor\Stripe also uses setup_future_usage
to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $shipping Shipping information for this PaymentIntent.
* @property null|string|\SimplePay\Vendor\Stripe\Account|\SimplePay\Vendor\Stripe\BankAccount|\SimplePay\Vendor\Stripe\Card|\SimplePay\Vendor\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.
@@ -68,6 +69,9 @@ class PaymentIntent extends ApiResource
use ApiOperations\Search;
use ApiOperations\Update;
+ const SECRET_KEY_CONFIRMATION_OPTIONAL = 'optional';
+ const SECRET_KEY_CONFIRMATION_REQUIRED = 'required';
+
const STATUS_CANCELED = 'canceled';
const STATUS_PROCESSING = 'processing';
const STATUS_REQUIRES_ACTION = 'requires_action';
diff --git a/lib/Stripe/lib/PaymentLink.php b/lib/Stripe/lib/PaymentLink.php
index ea71e3e1..8b93cd58 100644
--- a/lib/Stripe/lib/PaymentLink.php
+++ b/lib/Stripe/lib/PaymentLink.php
@@ -27,12 +27,16 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $automatic_tax
* @property string $billing_address_collection Configuration for collecting the customer's billing address.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $consent_collection When set, provides configuration to gather active consent from customers.
+ * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $custom_text
* @property string $customer_creation Configuration for Customer creation during checkout.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $invoice_creation Configuration for creating invoice for payment mode payment links.
* @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> $line_items The line items representing what is being sold.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string|\SimplePay\Vendor\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the Connect documentation for details.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $payment_intent_data Indicates the parameters to be passed to PaymentIntent creation during checkout.
+ * @property string $payment_method_collection Configuration for collecting a payment method during checkout.
* @property null|string[] $payment_method_types The list of payment method types that customers can use. When null
, SimplePay\Vendor\Stripe will dynamically show relevant payment methods you've enabled in your payment method settings.
* @property \SimplePay\Vendor\Stripe\StripeObject $phone_number_collection
* @property null|\SimplePay\Vendor\Stripe\StripeObject $shipping_address_collection Configuration for collecting the customer's shipping address.
@@ -58,6 +62,9 @@ class PaymentLink extends ApiResource
const CUSTOMER_CREATION_ALWAYS = 'always';
const CUSTOMER_CREATION_IF_REQUIRED = 'if_required';
+ const PAYMENT_METHOD_COLLECTION_ALWAYS = 'always';
+ const PAYMENT_METHOD_COLLECTION_IF_REQUIRED = 'if_required';
+
const SUBMIT_TYPE_AUTO = 'auto';
const SUBMIT_TYPE_BOOK = 'book';
const SUBMIT_TYPE_DONATE = 'donate';
diff --git a/lib/Stripe/lib/PaymentMethod.php b/lib/Stripe/lib/PaymentMethod.php
index 4be14a3d..b2c5a876 100644
--- a/lib/Stripe/lib/PaymentMethod.php
+++ b/lib/Stripe/lib/PaymentMethod.php
@@ -30,6 +30,7 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $boleto
* @property \SimplePay\Vendor\Stripe\StripeObject $card
* @property \SimplePay\Vendor\Stripe\StripeObject $card_present
+ * @property \SimplePay\Vendor\Stripe\StripeObject $cashapp
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\SimplePay\Vendor\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 \SimplePay\Vendor\Stripe\StripeObject $customer_balance
@@ -47,6 +48,8 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $oxxo
* @property \SimplePay\Vendor\Stripe\StripeObject $p24
* @property \SimplePay\Vendor\Stripe\StripeObject $paynow
+ * @property \SimplePay\Vendor\Stripe\StripeObject $paypal
+ * @property \SimplePay\Vendor\Stripe\StripeObject $pix
* @property \SimplePay\Vendor\Stripe\StripeObject $promptpay
* @property \SimplePay\Vendor\Stripe\StripeObject $radar_options Options to configure Radar. See Radar Session for more information.
* @property \SimplePay\Vendor\Stripe\StripeObject $sepa_debit
@@ -54,6 +57,7 @@
* @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 \SimplePay\Vendor\Stripe\StripeObject $us_bank_account
* @property \SimplePay\Vendor\Stripe\StripeObject $wechat_pay
+ * @property \SimplePay\Vendor\Stripe\StripeObject $zip
*/
class PaymentMethod extends ApiResource
{
diff --git a/lib/Stripe/lib/Price.php b/lib/Stripe/lib/Price.php
index 1ebc7a0f..b939a92c 100644
--- a/lib/Stripe/lib/Price.php
+++ b/lib/Stripe/lib/Price.php
@@ -34,6 +34,7 @@
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @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 \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $migrate_to Subscriptions using this price will be migrated to use the new referenced price.
* @property null|string $nickname A brief description of the price, hidden from customers.
* @property string|\SimplePay\Vendor\Stripe\Product $product The ID of the product this price is associated with.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $recurring The recurring components of a price such as interval
and usage_type
.
diff --git a/lib/Stripe/lib/Product.php b/lib/Stripe/lib/Product.php
index d2e24f2c..a46f5bc6 100644
--- a/lib/Stripe/lib/Product.php
+++ b/lib/Stripe/lib/Product.php
@@ -34,11 +34,12 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $name The product's name, meant to be displayable to the customer.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $provisioning Provisioning configuration for this product.
* @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|\SimplePay\Vendor\Stripe\TaxCode $tax_code A tax code ID.
* @property string $type The type of the product. The product is either of type good
, which is eligible for use with Orders and SKUs, or service
, which is eligible for use with Subscriptions and Plans.
- * @property null|string $unit_label A label that represents units of this product in SimplePay\Vendor\Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions.
+ * @property null|string $unit_label A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal.
* @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.
*/
diff --git a/lib/Stripe/lib/Quote.php b/lib/Stripe/lib/Quote.php
index ef786c22..656fb1fa 100644
--- a/lib/Stripe/lib/Quote.php
+++ b/lib/Stripe/lib/Quote.php
@@ -17,7 +17,7 @@
* @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 SimplePay\Vendor\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 SimplePay\Vendor\Stripe account. Only applicable if there are line items with recurring prices on the quote.
* @property \SimplePay\Vendor\Stripe\StripeObject $automatic_tax
- * @property string $collection_method Either charge_automatically
, or send_invoice
. When charging automatically, SimplePay\Vendor\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, SimplePay\Vendor\Stripe will email your customer an invoice with payment instructions. Defaults to charge_automatically
.
+ * @property string $collection_method Either charge_automatically
, or send_invoice
. When charging automatically, SimplePay\Vendor\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, SimplePay\Vendor\Stripe will email your customer an invoice with payment instructions and mark the subscription as active
. Defaults to charge_automatically
.
* @property \SimplePay\Vendor\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 ISO currency code, in lowercase. Must be a supported currency.
@@ -32,15 +32,19 @@
* @property null|string|\SimplePay\Vendor\Stripe\Invoice $invoice The invoice that was created from this quote.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $invoice_settings All invoices will be billed using the specified settings.
* @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> $line_items A list of items the customer is being quoted for.
+ * @property null|string[] $lines A list of lines on the quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $number A unique number that identifies this particular quote. This number is assigned once the quote is finalized.
* @property null|string|\SimplePay\Vendor\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the Connect documentation for details.
* @property string $status The status of the quote.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $status_details Details on when and why a quote has been marked as stale or canceled.
* @property \SimplePay\Vendor\Stripe\StripeObject $status_transitions
* @property null|string|\SimplePay\Vendor\Stripe\Subscription $subscription The subscription that was created or updated from this quote.
* @property \SimplePay\Vendor\Stripe\StripeObject $subscription_data
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject[] $subscription_data_overrides
* @property null|string|\SimplePay\Vendor\Stripe\SubscriptionSchedule $subscription_schedule The subscription schedule that was created or updated from this quote.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject[] $subscription_schedules The subscription schedules that were created or updated from this quote.
* @property null|string|\SimplePay\Vendor\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this quote belongs to.
* @property \SimplePay\Vendor\Stripe\StripeObject $total_details
* @property null|\SimplePay\Vendor\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.
@@ -58,9 +62,11 @@ class Quote extends ApiResource
const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
const STATUS_ACCEPTED = 'accepted';
+ const STATUS_ACCEPTING = 'accepting';
const STATUS_CANCELED = 'canceled';
const STATUS_DRAFT = 'draft';
const STATUS_OPEN = 'open';
+ const STATUS_STALE = 'stale';
/**
* @param callable $readBodyChunkCallable
@@ -114,6 +120,23 @@ public function cancel($params = null, $opts = null)
return $this;
}
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Quote the drafted quote
+ */
+ public function draftQuote($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/mark_draft';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
+
/**
* @param null|array $params
* @param null|array|string $opts
@@ -168,4 +191,114 @@ public static function allLineItems($id, $params = null, $opts = null)
return $obj;
}
+
+ /**
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\QuoteLine> list of QuoteLines
+ */
+ public static function allLines($id, $params = null, $opts = null)
+ {
+ $url = static::resourceUrl($id) . '/lines';
+ list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
+ $obj = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Quote the marked quote
+ */
+ public function markStaleQuote($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/mark_stale';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
+
+ /**
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\InvoiceLineItem> list of InvoiceLineItems
+ */
+ public static function previewInvoiceLines($id, $params = null, $opts = null)
+ {
+ $url = static::resourceUrl($id) . '/preview_invoice_lines';
+ list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
+ $obj = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+
+ /**
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Invoice> list of Invoices
+ */
+ public static function previewInvoices($id, $params = null, $opts = null)
+ {
+ $url = static::resourceUrl($id) . '/preview_invoices';
+ list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
+ $obj = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+
+ /**
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\SubscriptionSchedule> list of SubscriptionSchedules
+ */
+ public static function previewSubscriptionSchedules($id, $params = null, $opts = null)
+ {
+ $url = static::resourceUrl($id) . '/preview_subscription_schedules';
+ list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
+ $obj = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Quote the reestimated quote
+ */
+ public function reestimate($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/reestimate';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
}
diff --git a/lib/Stripe/lib/QuotePhase.php b/lib/Stripe/lib/QuotePhase.php
new file mode 100644
index 00000000..22ac9833
--- /dev/null
+++ b/lib/Stripe/lib/QuotePhase.php
@@ -0,0 +1,62 @@
+reset, the billing_cycle_anchor of the subscription is set to the start of the phase when entering the phase. If unset, then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle documentation.
+ * @property null|string $collection_method Either charge_automatically
, or send_invoice
. When charging automatically, SimplePay\Vendor\Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, SimplePay\Vendor\Stripe will email your customer an invoice with payment instructions and mark the subscription as active
.
+ * @property (string|\SimplePay\Vendor\Stripe\TaxRate)[] $default_tax_rates The default tax rates to apply to the subscription during this phase of the quote.
+ * @property (string|\SimplePay\Vendor\Stripe\Discount)[] $discounts The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts.
+ * @property null|int $end_date The end of this phase of the quote
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $invoice_settings The invoice settings applicable during this phase.
+ * @property null|int $iterations Integer representing the multiplier applied to the price interval. For example, iterations=2
applied to a price with interval=month
and interval_count=3
results in a phase of duration 2 * 3 months = 6 months
.
+ * @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> $line_items A list of items the customer is being quoted for.
+ * @property string $proration_behavior If the quote will prorate when transitioning to this phase. Possible values are create_prorations
and none
.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $total_details
+ * @property null|bool $trial If set to true the entire phase is counted as a trial and the customer will not be charged for any recurring fees.
+ * @property null|int $trial_end When the trial ends within the phase.
+ */
+class QuotePhase extends ApiResource
+{
+ const OBJECT_NAME = 'quote_phase';
+
+ use ApiOperations\All;
+ use ApiOperations\Retrieve;
+
+ const BILLING_CYCLE_ANCHOR_RESET = 'reset';
+
+ const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
+ const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
+
+ const PRORATION_BEHAVIOR_ALWAYS_INVOICE = 'always_invoice';
+ const PRORATION_BEHAVIOR_CREATE_PRORATIONS = 'create_prorations';
+ const PRORATION_BEHAVIOR_NONE = 'none';
+
+ /**
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> 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 = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+}
diff --git a/lib/Stripe/lib/SKU.php b/lib/Stripe/lib/SKU.php
deleted file mode 100644
index cb3ae947..00000000
--- a/lib/Stripe/lib/SKU.php
+++ /dev/null
@@ -1,41 +0,0 @@
-stock keeping units.
- * SKUs describe specific product variations, taking into account any combination
- * of: attributes, currency, and cost. For example, a product may be a T-shirt,
- * whereas a specific SKU represents the size: large
, color:
- * red
version of that shirt.
- *
- * Can also be used to manage inventory.
- *
- * @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.
- * @property \SimplePay\Vendor\Stripe\StripeObject $attributes A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are ["size", "gender"]
, a valid SKU has the following dictionary of attributes: {"size": "Medium", "gender": "Unisex"}
.
- * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
- * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
- * @property null|string $image The URL of an image for this SKU, meant to be displayable to the customer.
- * @property \SimplePay\Vendor\Stripe\StripeObject $inventory
- * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
- * @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
- * @property null|\SimplePay\Vendor\Stripe\StripeObject $package_dimensions The dimensions of this SKU for shipping purposes.
- * @property int $price The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency).
- * @property string|\SimplePay\Vendor\Stripe\Product $product The ID of the product this SKU is associated with. The product must be currently active.
- * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
- */
-class SKU extends ApiResource
-{
- const OBJECT_NAME = 'sku';
-
- use ApiOperations\All;
- use ApiOperations\Create;
- use ApiOperations\Delete;
- use ApiOperations\Retrieve;
- use ApiOperations\Update;
-}
diff --git a/lib/Stripe/lib/Service/AbstractServiceFactory.php b/lib/Stripe/lib/Service/AbstractServiceFactory.php
index bb6b9709..3e351026 100644
--- a/lib/Stripe/lib/Service/AbstractServiceFactory.php
+++ b/lib/Stripe/lib/Service/AbstractServiceFactory.php
@@ -42,6 +42,16 @@ abstract protected function getServiceClass($name);
* @return null|AbstractService|AbstractServiceFactory
*/
public function __get($name)
+ {
+ return $this->getService($name);
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return null|AbstractService|AbstractServiceFactory
+ */
+ public function getService($name)
{
$serviceClass = $this->getServiceClass($name);
if (null !== $serviceClass) {
diff --git a/lib/Stripe/lib/Service/AccountSessionService.php b/lib/Stripe/lib/Service/AccountSessionService.php
new file mode 100644
index 00000000..176773b1
--- /dev/null
+++ b/lib/Stripe/lib/Service/AccountSessionService.php
@@ -0,0 +1,24 @@
+request('post', '/v1/account_sessions', $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/Capital/CapitalServiceFactory.php b/lib/Stripe/lib/Service/Capital/CapitalServiceFactory.php
new file mode 100644
index 00000000..b6576ea0
--- /dev/null
+++ b/lib/Stripe/lib/Service/Capital/CapitalServiceFactory.php
@@ -0,0 +1,29 @@
+
+ */
+ private static $classMap = [
+ 'financingOffers' => FinancingOfferService::class,
+ 'financingSummary' => FinancingSummaryService::class,
+ 'financingTransactions' => FinancingTransactionService::class,
+ ];
+
+ protected function getServiceClass($name)
+ {
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
+ }
+}
diff --git a/lib/Stripe/lib/Service/Capital/FinancingOfferService.php b/lib/Stripe/lib/Service/Capital/FinancingOfferService.php
new file mode 100644
index 00000000..01ff77c2
--- /dev/null
+++ b/lib/Stripe/lib/Service/Capital/FinancingOfferService.php
@@ -0,0 +1,58 @@
+
+ */
+ public function all($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/capital/financing_offers', $params, $opts);
+ }
+
+ /**
+ * Acknowledges that platform has received and delivered the financing_offer to the
+ * intended merchant recipient. This is required to make the application
+ * accessible.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Capital\FinancingOffer
+ */
+ public function markDelivered($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/capital/financing_offers/%s/mark_delivered', $id), $params, $opts);
+ }
+
+ /**
+ * Get the details of the financing offer.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Capital\FinancingOffer
+ */
+ public function retrieve($id, $params = null, $opts = null)
+ {
+ return $this->request('get', $this->buildPath('/v1/capital/financing_offers/%s', $id), $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/Capital/FinancingSummaryService.php b/lib/Stripe/lib/Service/Capital/FinancingSummaryService.php
new file mode 100644
index 00000000..0d5c4b9c
--- /dev/null
+++ b/lib/Stripe/lib/Service/Capital/FinancingSummaryService.php
@@ -0,0 +1,24 @@
+request('get', '/v1/capital/financing_summary', $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/Capital/FinancingTransactionService.php b/lib/Stripe/lib/Service/Capital/FinancingTransactionService.php
new file mode 100644
index 00000000..040567dd
--- /dev/null
+++ b/lib/Stripe/lib/Service/Capital/FinancingTransactionService.php
@@ -0,0 +1,40 @@
+
+ */
+ public function all($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/capital/financing_transactions', $params, $opts);
+ }
+
+ /**
+ * Retrieves a financing transaction for a financing offer.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Capital\FinancingTransaction
+ */
+ public function retrieve($id, $params = null, $opts = null)
+ {
+ return $this->request('get', $this->buildPath('/v1/capital/financing_transactions/%s', $id), $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/CoreServiceFactory.php b/lib/Stripe/lib/Service/CoreServiceFactory.php
index 4c932659..97952591 100644
--- a/lib/Stripe/lib/Service/CoreServiceFactory.php
+++ b/lib/Stripe/lib/Service/CoreServiceFactory.php
@@ -9,12 +9,14 @@
*
* @property AccountLinkService $accountLinks
* @property AccountService $accounts
+ * @property AccountSessionService $accountSessions
* @property ApplePayDomainService $applePayDomains
* @property ApplicationFeeService $applicationFees
* @property Apps\AppsServiceFactory $apps
* @property BalanceService $balance
* @property BalanceTransactionService $balanceTransactions
* @property BillingPortal\BillingPortalServiceFactory $billingPortal
+ * @property Capital\CapitalServiceFactory $capital
* @property ChargeService $charges
* @property Checkout\CheckoutServiceFactory $checkout
* @property CountrySpecService $countrySpecs
@@ -28,6 +30,7 @@
* @property FileLinkService $fileLinks
* @property FileService $files
* @property FinancialConnections\FinancialConnectionsServiceFactory $financialConnections
+ * @property GiftCards\GiftCardsServiceFactory $giftCards
* @property Identity\IdentityServiceFactory $identity
* @property InvoiceItemService $invoiceItems
* @property InvoiceService $invoices
@@ -43,6 +46,7 @@
* @property PriceService $prices
* @property ProductService $products
* @property PromotionCodeService $promotionCodes
+ * @property QuotePhaseService $quotePhases
* @property QuoteService $quotes
* @property Radar\RadarServiceFactory $radar
* @property RefundService $refunds
@@ -52,11 +56,11 @@
* @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 Tax\TaxServiceFactory $tax
* @property TaxCodeService $taxCodes
* @property TaxRateService $taxRates
* @property Terminal\TerminalServiceFactory $terminal
@@ -75,12 +79,14 @@ class CoreServiceFactory extends \SimplePay\Vendor\Stripe\Service\AbstractServic
private static $classMap = [
'accountLinks' => AccountLinkService::class,
'accounts' => AccountService::class,
+ 'accountSessions' => AccountSessionService::class,
'applePayDomains' => ApplePayDomainService::class,
'applicationFees' => ApplicationFeeService::class,
'apps' => Apps\AppsServiceFactory::class,
'balance' => BalanceService::class,
'balanceTransactions' => BalanceTransactionService::class,
'billingPortal' => BillingPortal\BillingPortalServiceFactory::class,
+ 'capital' => Capital\CapitalServiceFactory::class,
'charges' => ChargeService::class,
'checkout' => Checkout\CheckoutServiceFactory::class,
'countrySpecs' => CountrySpecService::class,
@@ -94,6 +100,7 @@ class CoreServiceFactory extends \SimplePay\Vendor\Stripe\Service\AbstractServic
'fileLinks' => FileLinkService::class,
'files' => FileService::class,
'financialConnections' => FinancialConnections\FinancialConnectionsServiceFactory::class,
+ 'giftCards' => GiftCards\GiftCardsServiceFactory::class,
'identity' => Identity\IdentityServiceFactory::class,
'invoiceItems' => InvoiceItemService::class,
'invoices' => InvoiceService::class,
@@ -109,6 +116,7 @@ class CoreServiceFactory extends \SimplePay\Vendor\Stripe\Service\AbstractServic
'prices' => PriceService::class,
'products' => ProductService::class,
'promotionCodes' => PromotionCodeService::class,
+ 'quotePhases' => QuotePhaseService::class,
'quotes' => QuoteService::class,
'radar' => Radar\RadarServiceFactory::class,
'refunds' => RefundService::class,
@@ -118,11 +126,11 @@ class CoreServiceFactory extends \SimplePay\Vendor\Stripe\Service\AbstractServic
'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,
+ 'tax' => Tax\TaxServiceFactory::class,
'taxCodes' => TaxCodeService::class,
'taxRates' => TaxRateService::class,
'terminal' => Terminal\TerminalServiceFactory::class,
diff --git a/lib/Stripe/lib/Service/CustomerService.php b/lib/Stripe/lib/Service/CustomerService.php
index ce014698..0e672771 100644
--- a/lib/Stripe/lib/Service/CustomerService.php
+++ b/lib/Stripe/lib/Service/CustomerService.php
@@ -39,6 +39,23 @@ 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 transactions that modified the customer’s cash balance.
+ *
+ * @param string $parentId
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\CustomerCashBalanceTransaction>
+ */
+ public function allCashBalanceTransactions($parentId, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions', $parentId), $params, $opts);
+ }
+
/**
* Returns a list of PaymentMethods for a given Customer.
*
@@ -292,6 +309,24 @@ public function retrieveCashBalance($parentId, $params = null, $opts = null)
return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts);
}
+ /**
+ * Retrieves a specific cash balance transaction, which updated the customer’s cash balance.
+ *
+ * @param string $parentId
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\CustomerCashBalanceTransaction
+ */
+ public function retrieveCashBalanceTransaction($parentId, $id, $params = null, $opts = null)
+ {
+ return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions/%s', $parentId, $id), $params, $opts);
+ }
+
/**
* Retrieves a PaymentMethod object for a given Customer.
*
diff --git a/lib/Stripe/lib/Service/FinancialConnections/AccountService.php b/lib/Stripe/lib/Service/FinancialConnections/AccountService.php
index d2eb2b8d..96eb23d1 100644
--- a/lib/Stripe/lib/Service/FinancialConnections/AccountService.php
+++ b/lib/Stripe/lib/Service/FinancialConnections/AccountService.php
@@ -21,6 +21,23 @@ public function all($params = null, $opts = null)
return $this->requestCollection('get', '/v1/financial_connections/accounts', $params, $opts);
}
+ /**
+ * Lists the recorded inferred balances for a Financial Connections
+ * Account
.
+ *
+ * @param string $parentId
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\FinancialConnections\InferredBalance>
+ */
+ public function allInferredBalances($parentId, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/financial_connections/accounts/%s/inferred_balances', $parentId), $params, $opts);
+ }
+
/**
* Lists all owners for a given Account
.
*
diff --git a/lib/Stripe/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php b/lib/Stripe/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php
index dff0d9ab..100264dd 100644
--- a/lib/Stripe/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php
+++ b/lib/Stripe/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php
@@ -9,6 +9,7 @@
*
* @property AccountService $accounts
* @property SessionService $sessions
+ * @property TransactionService $transactions
*/
class FinancialConnectionsServiceFactory extends \SimplePay\Vendor\Stripe\Service\AbstractServiceFactory
{
@@ -18,6 +19,7 @@ class FinancialConnectionsServiceFactory extends \SimplePay\Vendor\Stripe\Servic
private static $classMap = [
'accounts' => AccountService::class,
'sessions' => SessionService::class,
+ 'transactions' => TransactionService::class,
];
protected function getServiceClass($name)
diff --git a/lib/Stripe/lib/Service/FinancialConnections/TransactionService.php b/lib/Stripe/lib/Service/FinancialConnections/TransactionService.php
new file mode 100644
index 00000000..6471d51c
--- /dev/null
+++ b/lib/Stripe/lib/Service/FinancialConnections/TransactionService.php
@@ -0,0 +1,23 @@
+Transaction objects.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\FinancialConnections\Transaction>
+ */
+ public function all($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/financial_connections/transactions', $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/GiftCards/CardService.php b/lib/Stripe/lib/Service/GiftCards/CardService.php
new file mode 100644
index 00000000..7355b378
--- /dev/null
+++ b/lib/Stripe/lib/Service/GiftCards/CardService.php
@@ -0,0 +1,86 @@
+
+ */
+ public function all($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/gift_cards/cards', $params, $opts);
+ }
+
+ /**
+ * Creates a new gift card object.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Card
+ */
+ public function create($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/gift_cards/cards', $params, $opts);
+ }
+
+ /**
+ * Retrieve a gift card by id.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Card
+ */
+ public function retrieve($id, $params = null, $opts = null)
+ {
+ return $this->request('get', $this->buildPath('/v1/gift_cards/cards/%s', $id), $params, $opts);
+ }
+
+ /**
+ * Update a gift card.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Card
+ */
+ public function update($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/gift_cards/cards/%s', $id), $params, $opts);
+ }
+
+ /**
+ * Validates a gift card code, returning the matching gift card object if it
+ * exists.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Card
+ */
+ public function validate($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/gift_cards/cards/validate', $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/GiftCards/GiftCardsServiceFactory.php b/lib/Stripe/lib/Service/GiftCards/GiftCardsServiceFactory.php
new file mode 100644
index 00000000..3b295de6
--- /dev/null
+++ b/lib/Stripe/lib/Service/GiftCards/GiftCardsServiceFactory.php
@@ -0,0 +1,27 @@
+
+ */
+ private static $classMap = [
+ 'cards' => CardService::class,
+ 'transactions' => TransactionService::class,
+ ];
+
+ protected function getServiceClass($name)
+ {
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
+ }
+}
diff --git a/lib/Stripe/lib/Service/GiftCards/TransactionService.php b/lib/Stripe/lib/Service/GiftCards/TransactionService.php
new file mode 100644
index 00000000..127788dd
--- /dev/null
+++ b/lib/Stripe/lib/Service/GiftCards/TransactionService.php
@@ -0,0 +1,102 @@
+
+ */
+ public function all($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/gift_cards/transactions', $params, $opts);
+ }
+
+ /**
+ * Cancel a gift card transaction.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Transaction
+ */
+ public function cancel($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/gift_cards/transactions/%s/cancel', $id), $params, $opts);
+ }
+
+ /**
+ * Confirm a gift card transaction.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Transaction
+ */
+ public function confirm($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/gift_cards/transactions/%s/confirm', $id), $params, $opts);
+ }
+
+ /**
+ * Create a gift card transaction.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Transaction
+ */
+ public function create($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/gift_cards/transactions', $params, $opts);
+ }
+
+ /**
+ * Retrieves the gift card transaction.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Transaction
+ */
+ public function retrieve($id, $params = null, $opts = null)
+ {
+ return $this->request('get', $this->buildPath('/v1/gift_cards/transactions/%s', $id), $params, $opts);
+ }
+
+ /**
+ * Update a gift card transaction.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\GiftCards\Transaction
+ */
+ public function update($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/gift_cards/transactions/%s', $id), $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/InvoiceService.php b/lib/Stripe/lib/Service/InvoiceService.php
index ddb86f61..5c077f53 100644
--- a/lib/Stripe/lib/Service/InvoiceService.php
+++ b/lib/Stripe/lib/Service/InvoiceService.php
@@ -43,12 +43,10 @@ public function allLines($parentId, $params = null, $opts = null)
}
/**
- * This endpoint creates a draft invoice for a given customer. The draft invoice
- * created pulls in all pending invoice items on that customer, including
- * prorations. The invoice remains a draft until you finalize the invoice, which allows you to pay or send the invoice to
- * your customers.
+ * This endpoint creates a draft invoice for a given customer. The invoice remains
+ * a draft until you finalize the invoice, which
+ * allows you to pay or send
+ * the invoice to your customers.
*
* @param null|array $params
* @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
diff --git a/lib/Stripe/lib/Service/Issuing/AuthorizationService.php b/lib/Stripe/lib/Service/Issuing/AuthorizationService.php
index bc299871..37f4c132 100644
--- a/lib/Stripe/lib/Service/Issuing/AuthorizationService.php
+++ b/lib/Stripe/lib/Service/Issuing/AuthorizationService.php
@@ -27,7 +27,9 @@ public function all($params = null, $opts = null)
* Approves a pending Issuing Authorization
object. This request
* should be made within the timeout window of the real-time
- * authorization flow.
+ * authorization flow. You can also respond directly to the webhook request to
+ * approve an authorization (preferred). More details can be found here.
*
* @param string $id
* @param null|array $params
@@ -46,7 +48,9 @@ public function approve($id, $params = null, $opts = null)
* Declines a pending Issuing Authorization
object. This request
* should be made within the timeout window of the real time
- * authorization flow.
+ * authorization flow. You can also respond directly to the webhook request to
+ * decline an authorization (preferred). More details can be found here.
*
* @param string $id
* @param null|array $params
diff --git a/lib/Stripe/lib/Service/PaymentIntentService.php b/lib/Stripe/lib/Service/PaymentIntentService.php
index 3f1aaf4e..16733653 100644
--- a/lib/Stripe/lib/Service/PaymentIntentService.php
+++ b/lib/Stripe/lib/Service/PaymentIntentService.php
@@ -40,8 +40,8 @@ public function applyCustomerBalance($id, $params = null, $opts = null)
/**
* A PaymentIntent object can be canceled when it is in one of these statuses:
* requires_payment_method
, requires_capture
,
- * requires_confirmation
, requires_action
, or
- * processing
.
+ * requires_confirmation
, requires_action
or, in rare cases, processing
.
*
* Once canceled, no additional charges will be made by the PaymentIntent and any
* operations on the PaymentIntent will fail with an error. For PaymentIntents with
@@ -50,7 +50,7 @@ public function applyCustomerBalance($id, $params = null, $opts = null)
*
* You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session
- * instead
+ * instead.
*
* @param string $id
* @param null|array $params
@@ -91,29 +91,25 @@ public function capture($id, $params = null, $opts = null)
/**
* Confirm that your customer intends to pay with current or provided payment
* method. Upon confirmation, the PaymentIntent will attempt to initiate a payment.
- *
* If the selected payment method requires additional authentication steps, the
* PaymentIntent will transition to the requires_action
status and
* suggest additional actions via next_action
. If payment fails, the
* PaymentIntent will transition to the requires_payment_method
* status. If payment succeeds, the PaymentIntent will transition to the
* succeeded
status (or requires_capture
, if
- * capture_method
is set to manual
).
- *
- * If the confirmation_method
is automatic
, payment may
- * be attempted using our capture_method is set to manual
). If the
+ * confirmation_method
is automatic
, payment may be
+ * attempted using our client SDKs and
* the PaymentIntent’s client_secret. After
* next_action
s are handled by the client, no additional confirmation
- * is required to complete the payment.
- *
- * If the confirmation_method
is manual
, all payment
- * attempts must be initiated using a secret key. If any actions are required for
- * the payment, the PaymentIntent will return to the
- * requires_confirmation
state after those actions are completed. Your
- * server needs to then explicitly re-confirm the PaymentIntent to initiate the
- * next payment attempt. Read the confirmation_method is
+ * manual
, all payment attempts must be initiated using a secret key.
+ * If any actions are required for the payment, the PaymentIntent will return to
+ * the requires_confirmation
state after those actions are completed.
+ * Your server needs to then explicitly re-confirm the PaymentIntent to initiate
+ * the next payment attempt. Read the expanded documentation to
* learn more about manual confirmation.
*
diff --git a/lib/Stripe/lib/Service/PaymentMethodService.php b/lib/Stripe/lib/Service/PaymentMethodService.php
index be7863a9..97dfd606 100644
--- a/lib/Stripe/lib/Service/PaymentMethodService.php
+++ b/lib/Stripe/lib/Service/PaymentMethodService.php
@@ -7,10 +7,10 @@
class PaymentMethodService extends \SimplePay\Vendor\Stripe\Service\AbstractService
{
/**
- * Returns a list of PaymentMethods attached to the StripeAccount. For listing a
- * customer’s payment methods, you should use List a Customer’s
- * PaymentMethods.
+ * PaymentMethods API instead.
*
* @param null|array $params
* @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
diff --git a/lib/Stripe/lib/Service/QuotePhaseService.php b/lib/Stripe/lib/Service/QuotePhaseService.php
new file mode 100644
index 00000000..41846692
--- /dev/null
+++ b/lib/Stripe/lib/Service/QuotePhaseService.php
@@ -0,0 +1,58 @@
+
+ */
+ public function all($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/quote_phases', $params, $opts);
+ }
+
+ /**
+ * When retrieving a quote phase, there is an includable
+ * line_items property containing the first handful of those
+ * items. There is also a URL where you can retrieve the full (paginated) list of
+ * line items.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem>
+ */
+ public function allLineItems($id, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/quote_phases/%s/line_items', $id), $params, $opts);
+ }
+
+ /**
+ * Retrieves the quote phase with the given ID.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\QuotePhase
+ */
+ public function retrieve($id, $params = null, $opts = null)
+ {
+ return $this->request('get', $this->buildPath('/v1/quote_phases/%s', $id), $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/QuoteService.php b/lib/Stripe/lib/Service/QuoteService.php
index eaf66222..d550fdcb 100644
--- a/lib/Stripe/lib/Service/QuoteService.php
+++ b/lib/Stripe/lib/Service/QuoteService.php
@@ -74,6 +74,24 @@ public function allLineItems($id, $params = null, $opts = null)
return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/line_items', $id), $params, $opts);
}
+ /**
+ * When retrieving a quote, there is an includable lines property
+ * containing the first handful of those items. There is also a URL where you can
+ * retrieve the full (paginated) list of lines.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\QuoteLine>
+ */
+ public function allLines($id, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/lines', $id), $params, $opts);
+ }
+
/**
* Cancels the quote.
*
@@ -108,6 +126,22 @@ public function create($params = null, $opts = null)
return $this->request('post', '/v1/quotes', $params, $opts);
}
+ /**
+ * Converts a stale quote to draft.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Quote
+ */
+ public function draftQuote($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_draft', $id), $params, $opts);
+ }
+
/**
* Finalizes the quote.
*
@@ -124,6 +158,86 @@ public function finalizeQuote($id, $params = null, $opts = null)
return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts);
}
+ /**
+ * Converts a draft or open quote to stale.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Quote
+ */
+ public function markStaleQuote($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_stale', $id), $params, $opts);
+ }
+
+ /**
+ * Preview the invoice line items that would be generated by accepting the quote.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\InvoiceLineItem>
+ */
+ public function previewInvoiceLines($id, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoice_lines', $id), $params, $opts);
+ }
+
+ /**
+ * Preview the invoices that would be generated by accepting the quote.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Invoice>
+ */
+ public function previewInvoices($id, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoices', $id), $params, $opts);
+ }
+
+ /**
+ * Preview the schedules that would be generated by accepting the quote.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\SubscriptionSchedule>
+ */
+ public function previewSubscriptionSchedules($id, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_subscription_schedules', $id), $params, $opts);
+ }
+
+ /**
+ * Recompute the upcoming invoice estimate for the quote.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Quote
+ */
+ public function reestimate($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/quotes/%s/reestimate', $id), $params, $opts);
+ }
+
/**
* Retrieves the quote with the given ID.
*
diff --git a/lib/Stripe/lib/Service/SkuService.php b/lib/Stripe/lib/Service/SkuService.php
deleted file mode 100644
index 9398f88a..00000000
--- a/lib/Stripe/lib/Service/SkuService.php
+++ /dev/null
@@ -1,95 +0,0 @@
-
- */
- public function all($params = null, $opts = null)
- {
- return $this->requestCollection('get', '/v1/skus', $params, $opts);
- }
-
- /**
- * Creates a new SKU associated with a product.
- *
- * @param null|array $params
- * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
- *
- * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \SimplePay\Vendor\Stripe\SKU
- */
- public function create($params = null, $opts = null)
- {
- return $this->request('post', '/v1/skus', $params, $opts);
- }
-
- /**
- * Delete a SKU. Deleting a SKU is only possible until it has been used in an
- * order.
- *
- * @param string $id
- * @param null|array $params
- * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
- *
- * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \SimplePay\Vendor\Stripe\SKU
- */
- public function delete($id, $params = null, $opts = null)
- {
- return $this->request('delete', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
- }
-
- /**
- * Retrieves the details of an existing SKU. Supply the unique SKU identifier from
- * either a SKU creation request or from the product, and SimplePay\Vendor\Stripe will return the
- * corresponding SKU information.
- *
- * @param string $id
- * @param null|array $params
- * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
- *
- * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \SimplePay\Vendor\Stripe\SKU
- */
- public function retrieve($id, $params = null, $opts = null)
- {
- return $this->request('get', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
- }
-
- /**
- * Updates the specific SKU by setting the values of the parameters passed. Any
- * parameters not provided will be left unchanged.
- *
- * Note that a SKU’s attributes
are not editable. Instead, you would
- * need to deactivate the existing SKU and create a new one with the new attribute
- * values.
- *
- * @param string $id
- * @param null|array $params
- * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
- *
- * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
- *
- * @return \SimplePay\Vendor\Stripe\SKU
- */
- public function update($id, $params = null, $opts = null)
- {
- return $this->request('post', $this->buildPath('/v1/skus/%s', $id), $params, $opts);
- }
-}
diff --git a/lib/Stripe/lib/Service/SubscriptionScheduleService.php b/lib/Stripe/lib/Service/SubscriptionScheduleService.php
index 8b9bae9b..27ea453f 100644
--- a/lib/Stripe/lib/Service/SubscriptionScheduleService.php
+++ b/lib/Stripe/lib/Service/SubscriptionScheduleService.php
@@ -21,6 +21,22 @@ public function all($params = null, $opts = null)
return $this->requestCollection('get', '/v1/subscription_schedules', $params, $opts);
}
+ /**
+ * Amends an existing subscription schedule.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\SubscriptionSchedule
+ */
+ public function amend($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/amend', $id), $params, $opts);
+ }
+
/**
* Cancels a subscription schedule and its associated subscription immediately (if
* the subscription schedule has an active subscription). A subscription schedule
diff --git a/lib/Stripe/lib/Service/SubscriptionService.php b/lib/Stripe/lib/Service/SubscriptionService.php
index 8c6142d4..f8caa09e 100644
--- a/lib/Stripe/lib/Service/SubscriptionService.php
+++ b/lib/Stripe/lib/Service/SubscriptionService.php
@@ -97,6 +97,27 @@ public function deleteDiscount($id, $params = null, $opts = null)
return $this->request('delete', $this->buildPath('/v1/subscriptions/%s/discount', $id), $params, $opts);
}
+ /**
+ * Initiates resumption of a paused subscription, optionally resetting the billing
+ * cycle anchor and creating prorations. If a resumption invoice is generated, it
+ * must be paid or marked uncollectible before the subscription will be unpaused.
+ * If payment succeeds the subscription will become active
, and if
+ * payment fails the subscription will be past_due
. The resumption
+ * invoice will void automatically if not paid by the expiration date.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Subscription
+ */
+ public function resume($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/subscriptions/%s/resume', $id), $params, $opts);
+ }
+
/**
* Retrieves the subscription with the given ID.
*
diff --git a/lib/Stripe/lib/Service/Tax/CalculationService.php b/lib/Stripe/lib/Service/Tax/CalculationService.php
new file mode 100644
index 00000000..7cd5c1eb
--- /dev/null
+++ b/lib/Stripe/lib/Service/Tax/CalculationService.php
@@ -0,0 +1,39 @@
+
+ */
+ public function allLineItems($id, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/tax/calculations/%s/line_items', $id), $params, $opts);
+ }
+
+ /**
+ * Calculates tax based on input and returns a Tax Calculation
object.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Calculation
+ */
+ public function create($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/tax/calculations', $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/Tax/RegistrationService.php b/lib/Stripe/lib/Service/Tax/RegistrationService.php
new file mode 100644
index 00000000..0180be62
--- /dev/null
+++ b/lib/Stripe/lib/Service/Tax/RegistrationService.php
@@ -0,0 +1,57 @@
+Registration objects.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Tax\Registration>
+ */
+ public function all($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/tax/registrations', $params, $opts);
+ }
+
+ /**
+ * Creates a new Tax Registration
object.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Registration
+ */
+ public function create($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/tax/registrations', $params, $opts);
+ }
+
+ /**
+ * Updates an existing Tax Registration
object.
+ *
+ * A registration cannot be deleted after it has been created. If you wish to end a
+ * registration you may do so by setting expires_at
.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Registration
+ */
+ public function update($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/tax/registrations/%s', $id), $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/Tax/SettingsService.php b/lib/Stripe/lib/Service/Tax/SettingsService.php
new file mode 100644
index 00000000..d50a1fad
--- /dev/null
+++ b/lib/Stripe/lib/Service/Tax/SettingsService.php
@@ -0,0 +1,39 @@
+Settings for a merchant.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Settings
+ */
+ public function retrieve($params = null, $opts = null)
+ {
+ return $this->request('get', '/v1/tax/settings', $params, $opts);
+ }
+
+ /**
+ * Updates Tax Settings
parameters used in tax calculations. All
+ * parameters are editable but none can be removed once set.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Settings
+ */
+ public function update($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/tax/settings', $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/Tax/TaxServiceFactory.php b/lib/Stripe/lib/Service/Tax/TaxServiceFactory.php
new file mode 100644
index 00000000..3edfcb12
--- /dev/null
+++ b/lib/Stripe/lib/Service/Tax/TaxServiceFactory.php
@@ -0,0 +1,31 @@
+
+ */
+ private static $classMap = [
+ 'calculations' => CalculationService::class,
+ 'registrations' => RegistrationService::class,
+ 'settings' => SettingsService::class,
+ 'transactions' => TransactionService::class,
+ ];
+
+ protected function getServiceClass($name)
+ {
+ return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
+ }
+}
diff --git a/lib/Stripe/lib/Service/Tax/TransactionService.php b/lib/Stripe/lib/Service/Tax/TransactionService.php
new file mode 100644
index 00000000..9ec477e8
--- /dev/null
+++ b/lib/Stripe/lib/Service/Tax/TransactionService.php
@@ -0,0 +1,85 @@
+
+ */
+ public function allLineItems($id, $params = null, $opts = null)
+ {
+ return $this->requestCollection('get', $this->buildPath('/v1/tax/transactions/%s/line_items', $id), $params, $opts);
+ }
+
+ /**
+ * Lists Tax Transaction objects.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Tax\Transaction>
+ */
+ public function allTransactions($params = null, $opts = null)
+ {
+ return $this->requestCollection('get', '/v1/tax/transactions', $params, $opts);
+ }
+
+ /**
+ * Creates a Tax Transaction
from a calculation.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Transaction
+ */
+ public function create($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/tax/transactions', $params, $opts);
+ }
+
+ /**
+ * Partially or fully reverses a previously created Transaction
.
+ *
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Transaction
+ */
+ public function createReversal($params = null, $opts = null)
+ {
+ return $this->request('post', '/v1/tax/transactions/create_reversal', $params, $opts);
+ }
+
+ /**
+ * Retrieves a Tax Transaction
object.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Transaction
+ */
+ public function retrieve($id, $params = null, $opts = null)
+ {
+ return $this->request('get', $this->buildPath('/v1/tax/transactions/%s', $id), $params, $opts);
+ }
+}
diff --git a/lib/Stripe/lib/Service/Terminal/ReaderService.php b/lib/Stripe/lib/Service/Terminal/ReaderService.php
index 7f449e04..e3b242c9 100644
--- a/lib/Stripe/lib/Service/Terminal/ReaderService.php
+++ b/lib/Stripe/lib/Service/Terminal/ReaderService.php
@@ -100,6 +100,22 @@ public function processSetupIntent($id, $params = null, $opts = null)
return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/process_setup_intent', $id), $params, $opts);
}
+ /**
+ * Initiates a refund on a Reader.
+ *
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|\SimplePay\Vendor\Stripe\Util\RequestOptions $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Terminal\Reader
+ */
+ public function refundPayment($id, $params = null, $opts = null)
+ {
+ return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/refund_payment', $id), $params, $opts);
+ }
+
/**
* Retrieves a Reader
object.
*
diff --git a/lib/Stripe/lib/SetupAttempt.php b/lib/Stripe/lib/SetupAttempt.php
index 194fd220..b5e88db8 100644
--- a/lib/Stripe/lib/SetupAttempt.php
+++ b/lib/Stripe/lib/SetupAttempt.php
@@ -21,7 +21,7 @@
* @property null|string|\SimplePay\Vendor\Stripe\Account $on_behalf_of The value of on_behalf_of on the SetupIntent at the time of this confirmation.
* @property string|\SimplePay\Vendor\Stripe\PaymentMethod $payment_method ID of the payment method used with this SetupAttempt.
* @property \SimplePay\Vendor\Stripe\StripeObject $payment_method_details
- * @property null|\SimplePay\Vendor\Stripe\ErrorObject $setup_error The error encountered during this attempt to confirm the SetupIntent, if any.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $setup_error The error encountered during this attempt to confirm the SetupIntent, if any.
* @property string|\SimplePay\Vendor\Stripe\SetupIntent $setup_intent ID of the SetupIntent that this attempt belongs to.
* @property string $status Status of this SetupAttempt, one of requires_confirmation
, requires_action
, processing
, succeeded
, failed
, or abandoned
.
* @property string $usage The value of usage on the SetupIntent at the time of this confirmation, one of off_session
or on_session
.
diff --git a/lib/Stripe/lib/SetupIntent.php b/lib/Stripe/lib/SetupIntent.php
index e4147a42..d1351192 100644
--- a/lib/Stripe/lib/SetupIntent.php
+++ b/lib/Stripe/lib/SetupIntent.php
@@ -50,7 +50,7 @@
* @property null|string|\SimplePay\Vendor\Stripe\Customer $customer ID of the Customer this SetupIntent belongs to, if one exists.
If present, the SetupIntent's payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
* @property null|string[] $flow_directions Indicates the directions of money movement for which this payment method is intended to be used.
Include inbound
if you intend to use the payment method as the origin to pull funds from. Include outbound
if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.
- * @property null|\SimplePay\Vendor\Stripe\ErrorObject $last_setup_error The error encountered in the previous SetupIntent confirmation.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $last_setup_error The error encountered in the previous SetupIntent confirmation.
* @property null|string|\SimplePay\Vendor\Stripe\SetupAttempt $latest_attempt The most recent SetupAttempt for this SetupIntent.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|string|\SimplePay\Vendor\Stripe\Mandate $mandate ID of the multi use Mandate generated by the SetupIntent.
diff --git a/lib/Stripe/lib/SingletonApiResource.php b/lib/Stripe/lib/SingletonApiResource.php
index b28c3b77..3dcf48cf 100644
--- a/lib/Stripe/lib/SingletonApiResource.php
+++ b/lib/Stripe/lib/SingletonApiResource.php
@@ -7,15 +7,6 @@
*/
abstract class SingletonApiResource extends ApiResource
{
- protected static function _singletonRetrieve($options = null)
- {
- $opts = Util\RequestOptions::parse($options);
- $instance = new static(null, $opts);
- $instance->refresh();
-
- return $instance;
- }
-
/**
* @return string the endpoint associated with this singleton class
*/
diff --git a/lib/Stripe/lib/Source.php b/lib/Stripe/lib/Source.php
index 4d1b183c..2d103219 100644
--- a/lib/Stripe/lib/Source.php
+++ b/lib/Stripe/lib/Source.php
@@ -10,6 +10,12 @@
* API just like a Card
object: once chargeable, they can be charged,
* or can be attached to customers.
*
+ * SimplePay\Vendor\Stripe doesn't recommend using the deprecated Sources API. We recommend that
+ * you adopt the PaymentMethods API. This
+ * newer API provides access to our latest features and payment method types.
+ *
* Related guides: Sources API and Sources & Customers.
*
@@ -39,6 +45,7 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $multibanco
* @property null|\SimplePay\Vendor\Stripe\StripeObject $owner Information about the owner of the payment instrument that may be used or required by particular source types.
* @property \SimplePay\Vendor\Stripe\StripeObject $p24
+ * @property \SimplePay\Vendor\Stripe\StripeObject $paypal
* @property \SimplePay\Vendor\Stripe\StripeObject $receiver
* @property \SimplePay\Vendor\Stripe\StripeObject $redirect
* @property \SimplePay\Vendor\Stripe\StripeObject $sepa_credit_transfer
diff --git a/lib/Stripe/lib/Stripe.php b/lib/Stripe/lib/Stripe.php
index 773074bf..3f5f41a8 100644
--- a/lib/Stripe/lib/Stripe.php
+++ b/lib/Stripe/lib/Stripe.php
@@ -58,7 +58,7 @@ class Stripe
/** @var float Initial delay between retries, in seconds */
private static $initialNetworkRetryDelay = 0.5;
- const VERSION = '9.0.0';
+ const VERSION = '10.6.0-beta.1';
/**
* @return string the API key used for requests
@@ -90,7 +90,7 @@ public static function getLogger()
}
/**
- * @param Util\LoggerInterface $logger the logger to which the library
+ * @param \Psr\Log\LoggerInterface|Util\LoggerInterface $logger the logger to which the library
* will produce messages
*/
public static function setLogger($logger)
@@ -185,7 +185,7 @@ public static function getAccountId()
}
/**
- * @param string $accountId the SimplePay\Vendor\Stripe account ID to set for connected
+ * @param null|string $accountId the SimplePay\Vendor\Stripe account ID to set for connected
* account requests
*/
public static function setAccountId($accountId)
diff --git a/lib/Stripe/lib/StripeClient.php b/lib/Stripe/lib/StripeClient.php
index 2453dce5..7f0d5afd 100644
--- a/lib/Stripe/lib/StripeClient.php
+++ b/lib/Stripe/lib/StripeClient.php
@@ -8,6 +8,7 @@
* Client used to send requests to Stripe's API.
*
* @property \SimplePay\Vendor\Stripe\Service\AccountLinkService $accountLinks
+ * @property \SimplePay\Vendor\Stripe\Service\AccountSessionService $accountSessions
* @property \SimplePay\Vendor\Stripe\Service\AccountService $accounts
* @property \SimplePay\Vendor\Stripe\Service\ApplePayDomainService $applePayDomains
* @property \SimplePay\Vendor\Stripe\Service\ApplicationFeeService $applicationFees
@@ -15,6 +16,7 @@
* @property \SimplePay\Vendor\Stripe\Service\BalanceService $balance
* @property \SimplePay\Vendor\Stripe\Service\BalanceTransactionService $balanceTransactions
* @property \SimplePay\Vendor\Stripe\Service\BillingPortal\BillingPortalServiceFactory $billingPortal
+ * @property \SimplePay\Vendor\Stripe\Service\Capital\CapitalServiceFactory $capital
* @property \SimplePay\Vendor\Stripe\Service\ChargeService $charges
* @property \SimplePay\Vendor\Stripe\Service\Checkout\CheckoutServiceFactory $checkout
* @property \SimplePay\Vendor\Stripe\Service\CountrySpecService $countrySpecs
@@ -28,6 +30,7 @@
* @property \SimplePay\Vendor\Stripe\Service\FileLinkService $fileLinks
* @property \SimplePay\Vendor\Stripe\Service\FileService $files
* @property \SimplePay\Vendor\Stripe\Service\FinancialConnections\FinancialConnectionsServiceFactory $financialConnections
+ * @property \SimplePay\Vendor\Stripe\Service\GiftCards\GiftCardsServiceFactory $giftCards
* @property \SimplePay\Vendor\Stripe\Service\Identity\IdentityServiceFactory $identity
* @property \SimplePay\Vendor\Stripe\Service\InvoiceItemService $invoiceItems
* @property \SimplePay\Vendor\Stripe\Service\InvoiceService $invoices
@@ -43,6 +46,7 @@
* @property \SimplePay\Vendor\Stripe\Service\PriceService $prices
* @property \SimplePay\Vendor\Stripe\Service\ProductService $products
* @property \SimplePay\Vendor\Stripe\Service\PromotionCodeService $promotionCodes
+ * @property \SimplePay\Vendor\Stripe\Service\QuotePhaseService $quotePhases
* @property \SimplePay\Vendor\Stripe\Service\QuoteService $quotes
* @property \SimplePay\Vendor\Stripe\Service\Radar\RadarServiceFactory $radar
* @property \SimplePay\Vendor\Stripe\Service\RefundService $refunds
@@ -52,11 +56,11 @@
* @property \SimplePay\Vendor\Stripe\Service\SetupIntentService $setupIntents
* @property \SimplePay\Vendor\Stripe\Service\ShippingRateService $shippingRates
* @property \SimplePay\Vendor\Stripe\Service\Sigma\SigmaServiceFactory $sigma
- * @property \SimplePay\Vendor\Stripe\Service\SkuService $skus
* @property \SimplePay\Vendor\Stripe\Service\SourceService $sources
* @property \SimplePay\Vendor\Stripe\Service\SubscriptionItemService $subscriptionItems
* @property \SimplePay\Vendor\Stripe\Service\SubscriptionScheduleService $subscriptionSchedules
* @property \SimplePay\Vendor\Stripe\Service\SubscriptionService $subscriptions
+ * @property \SimplePay\Vendor\Stripe\Service\Tax\TaxServiceFactory $tax
* @property \SimplePay\Vendor\Stripe\Service\TaxCodeService $taxCodes
* @property \SimplePay\Vendor\Stripe\Service\TaxRateService $taxRates
* @property \SimplePay\Vendor\Stripe\Service\Terminal\TerminalServiceFactory $terminal
diff --git a/lib/Stripe/lib/Subscription.php b/lib/Stripe/lib/Subscription.php
index 64184e40..26547e66 100644
--- a/lib/Stripe/lib/Subscription.php
+++ b/lib/Stripe/lib/Subscription.php
@@ -21,7 +21,7 @@
* @property null|int $cancel_at A date in the future at which the subscription will automatically get canceled
* @property bool $cancel_at_period_end If the subscription has been canceled with the at_period_end
flag set to true
, cancel_at_period_end
on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.
* @property null|int $canceled_at If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with cancel_at_period_end
, canceled_at
will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.
- * @property string $collection_method Either charge_automatically
, or send_invoice
. When charging automatically, SimplePay\Vendor\Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, SimplePay\Vendor\Stripe will email your customer an invoice with payment instructions.
+ * @property string $collection_method Either charge_automatically
, or send_invoice
. When charging automatically, SimplePay\Vendor\Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, SimplePay\Vendor\Stripe will email your customer an invoice with payment instructions and mark the subscription as active
.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property int $current_period_end End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.
@@ -33,23 +33,27 @@
* @property null|\SimplePay\Vendor\Stripe\TaxRate[] $default_tax_rates The tax rates that will apply to any subscription item that does not have tax_rates
set. Invoices created will have their default_tax_rates
populated from the subscription.
* @property null|string $description The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in SimplePay\Vendor\Stripe surfaces.
* @property null|\SimplePay\Vendor\Stripe\Discount $discount Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis.
+ * @property null|(string|\SimplePay\Vendor\Stripe\Discount)[] $discounts The discounts applied to the subscription. Subscription item discounts are applied before subscription discounts. Use expand[]=discounts
to expand each discount.
* @property null|int $ended_at If the subscription has ended, the date the subscription ended.
* @property \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\SubscriptionItem> $items List of subscription items, each with an attached price.
* @property null|string|\SimplePay\Vendor\Stripe\Invoice $latest_invoice The most recent invoice this subscription has generated.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|int $next_pending_invoice_item_invoice Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at pending_invoice_item_interval
.
+ * @property null|string|\SimplePay\Vendor\Stripe\Account $on_behalf_of The account (if any) the charge was made on behalf of for charges associated with this subscription. See the Connect documentation for details.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $pause_collection If specified, payment collection for this subscription will be paused.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $payment_settings Payment settings passed on to invoices created by the subscription.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $pending_invoice_item_interval Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling Create an invoice for the given subscription at the specified interval.
* @property null|string|\SimplePay\Vendor\Stripe\SetupIntent $pending_setup_intent You can use this SetupIntent to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the SCA Migration Guide.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $pending_update If specified, pending updates that will be applied to the subscription once the latest_invoice
has been paid.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $prebilling Time period and invoice for a Subscription billed in advance.
* @property null|string|\SimplePay\Vendor\Stripe\SubscriptionSchedule $schedule The schedule attached to the subscription
* @property int $start_date Date when the subscription was first created. The date might differ from the created
date due to backdating.
* @property string $status Possible values are incomplete
, incomplete_expired
, trialing
, active
, past_due
, canceled
, or unpaid
.
For collection_method=charge_automatically
a subscription moves into incomplete
if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an active
state. If the first invoice is not paid within 23 hours, the subscription transitions to incomplete_expired
. This is a terminal state, the open invoice will be voided and no further invoices will be generated.
A subscription that is currently in a trial period is trialing
and moves to active
when the trial period is over.
If subscription collection_method=charge_automatically
it becomes past_due
when payment to renew it fails and canceled
or unpaid
(depending on your subscriptions settings) when SimplePay\Vendor\Stripe has exhausted all payment retry attempts.
If subscription collection_method=send_invoice
it becomes past_due
when its invoice is not paid by the due date, and canceled
or unpaid
if it is still not paid by an additional deadline after that. Note that when a subscription has a status of unpaid
, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.
* @property null|string|\SimplePay\Vendor\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this subscription belongs to.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $transfer_data The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
* @property null|int $trial_end If the subscription has a trial, the end of that trial.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $trial_settings Settings related to subscription trials.
* @property null|int $trial_start If the subscription has a trial, the beginning of that trial.
*/
class Subscription extends ApiResource
@@ -76,6 +80,7 @@ class Subscription extends ApiResource
const STATUS_INCOMPLETE = 'incomplete';
const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired';
const STATUS_PAST_DUE = 'past_due';
+ const STATUS_PAUSED = 'paused';
const STATUS_TRIALING = 'trialing';
const STATUS_UNPAID = 'unpaid';
@@ -129,6 +134,23 @@ public function cancel($params = null, $opts = null)
return $this;
}
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Subscription the resumed subscription
+ */
+ public function resume($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/resume';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
+
/**
* @param null|array $params
* @param null|array|string $opts
diff --git a/lib/Stripe/lib/SubscriptionItem.php b/lib/Stripe/lib/SubscriptionItem.php
index daf790d1..fa2af77a 100644
--- a/lib/Stripe/lib/SubscriptionItem.php
+++ b/lib/Stripe/lib/SubscriptionItem.php
@@ -12,12 +12,14 @@
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
+ * @property null|(string|\SimplePay\Vendor\Stripe\Discount)[] $discounts The discounts applied to the subscription item. Subscription item discounts are applied before subscription discounts. Use expand[]=discounts
to expand each discount.
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property \SimplePay\Vendor\Stripe\Plan $plan You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.
Plans define the base price, currency, and billing cycle for recurring purchases of products. Products help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.
For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.
Related guides: Set up a subscription and more about products and prices.
* @property \SimplePay\Vendor\Stripe\Price $price Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.
For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.
Related guides: Set up a subscription, create an invoice, and more about products and prices.
* @property int $quantity The quantity of the plan to which the customer should be subscribed.
* @property string $subscription The subscription
this subscription_item
belongs to.
* @property null|\SimplePay\Vendor\Stripe\TaxRate[] $tax_rates The tax rates which apply to this subscription_item
. When set, the default_tax_rates
on the subscription do not apply to this subscription_item
.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $trial Options that configure the trial on the subscription item.
*/
class SubscriptionItem extends ApiResource
{
diff --git a/lib/Stripe/lib/SubscriptionSchedule.php b/lib/Stripe/lib/SubscriptionSchedule.php
index 79ecec8f..8595a0ea 100644
--- a/lib/Stripe/lib/SubscriptionSchedule.php
+++ b/lib/Stripe/lib/SubscriptionSchedule.php
@@ -15,16 +15,19 @@
* @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|\SimplePay\Vendor\Stripe\StripeObject $application ID of the Connect Application that created the schedule.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $applies_to Details to identify the subscription schedule the quote line applies to.
+ * @property string $billing_behavior Configures when the subscription schedule generates prorations for phase transitions. Possible values are prorate_on_next_phase
or prorate_up_front
with the default being prorate_on_next_phase
. prorate_on_next_phase
will apply phase changes and generate prorations at transition time.prorate_up_front
will bill for all phases within the current billing cycle up front.
* @property null|int $canceled_at Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.
* @property null|int $completed_at Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $current_phase Object representing the start and end dates for the current phase of the subscription schedule, if it is active
.
* @property string|\SimplePay\Vendor\Stripe\Customer $customer ID of the customer who owns the subscription schedule.
* @property \SimplePay\Vendor\Stripe\StripeObject $default_settings
- * @property string $end_behavior Behavior of the subscription schedule and underlying subscription when it ends. Possible values are release
and cancel
.
+ * @property string $end_behavior Behavior of the subscription schedule and underlying subscription when it ends. Possible values are release
or cancel
with the default being release
. release
will end the subscription schedule and keep the underlying subscription running.cancel
will end the subscription schedule and cancel the underlying subscription.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property \SimplePay\Vendor\Stripe\StripeObject[] $phases Configuration for the subscription schedule's phases.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $prebilling Time period and invoice for a Subscription billed in advance.
* @property null|int $released_at Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.
* @property null|string $released_subscription ID of the subscription once managed by the subscription schedule (if it is released).
* @property string $status The present status of the subscription schedule. Possible values are not_started
, active
, completed
, released
, and canceled
. You can read more about the different states in our behavior guide.
@@ -40,6 +43,23 @@ class SubscriptionSchedule extends ApiResource
use ApiOperations\Retrieve;
use ApiOperations\Update;
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\SubscriptionSchedule the amended subscription schedule
+ */
+ public function amend($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/amend';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
+
/**
* @param null|array $params
* @param null|array|string $opts
diff --git a/lib/Stripe/lib/Tax/Calculation.php b/lib/Stripe/lib/Tax/Calculation.php
new file mode 100644
index 00000000..1383fc87
--- /dev/null
+++ b/lib/Stripe/lib/Tax/Calculation.php
@@ -0,0 +1,50 @@
+Calculation allows you to calculate the tax to collect from
+ * your customer.
+ *
+ * @property null|string $id Unique identifier for the calculation.
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
+ * @property int $amount_total Total after taxes.
+ * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
+ * @property null|string $customer The ID of an existing Customer used for the resource.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $customer_details
+ * @property null|int $expires_at Timestamp of date at which the tax calculation will expire. Empty if the calculation is an unsaved preview.
+ * @property null|\SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> $line_items The list of items the customer is purchasing.
+ * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property null|string $reference A custom unique identifier, such as 'myOrder_123'.
+ * @property int $tax_amount_exclusive The amount of tax to be collected on top of the line item prices.
+ * @property int $tax_amount_inclusive The amount of tax already included in the line item prices.
+ * @property \SimplePay\Vendor\Stripe\StripeObject[] $tax_breakdown Breakdown of individual tax amounts that add up to the total.
+ * @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation.
+ */
+class Calculation extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'tax.calculation';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\Create;
+
+ /**
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> list of TaxProductResourceTaxCalculationLineItems
+ */
+ 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 = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+}
diff --git a/lib/Stripe/lib/Tax/Registration.php b/lib/Stripe/lib/Tax/Registration.php
new file mode 100644
index 00000000..f0339225
--- /dev/null
+++ b/lib/Stripe/lib/Tax/Registration.php
@@ -0,0 +1,45 @@
+Registration lets us know that your business is registered to
+ * collect tax on payments within a region, enabling you to automatically collect tax.
+ *
+ * SimplePay\Vendor\Stripe will not register on your behalf with the relevant authorities when you
+ * create a Tax Registration
object. For more information on how to
+ * register to collect tax, see our guide.
+ *
+ * @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 $active_from Time at which the registration becomes active. Measured in seconds since the Unix epoch.
+ * @property string $country Two-letter country code (ISO 3166-1 alpha-2).
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
+ * @property null|int $expires_at If set, the registration stops being active at this time. If not set, the registration will be active indefinitely. Measured in seconds since the Unix epoch.
+ * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property null|string $state State, county, province, or region.
+ * @property string $status The status of the registration. This field is present for convenience and can be deduced from active_from
and expires_at
.
+ * @property string $type The type of the registration. See our guide for more information about registration types.
+ */
+class Registration extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'tax.registration';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\All;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Create;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Update;
+
+ const STATUS_ACTIVE = 'active';
+ const STATUS_EXPIRED = 'expired';
+ const STATUS_SCHEDULED = 'scheduled';
+
+ const TYPE_DOMESTIC_SMALL_SELLER = 'domestic_small_seller';
+ const TYPE_SIMPLIFIED = 'simplified';
+ const TYPE_STANDARD = 'standard';
+ const TYPE_VAT_OSS_NON_UNION = 'vat_oss_non_union';
+ const TYPE_VAT_OSS_UNION = 'vat_oss_union';
+}
diff --git a/lib/Stripe/lib/Tax/Settings.php b/lib/Stripe/lib/Tax/Settings.php
new file mode 100644
index 00000000..5b60dcbe
--- /dev/null
+++ b/lib/Stripe/lib/Tax/Settings.php
@@ -0,0 +1,25 @@
+Settings to manage configurations used by SimplePay\Vendor\Stripe
+ * Tax calculations.
+ *
+ * Related guide: Account
+ * settings.
+ *
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $defaults
+ * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property \SimplePay\Vendor\Stripe\StripeObject[] $locations The places where your business is located.
+ */
+class Settings extends \SimplePay\Vendor\Stripe\SingletonApiResource
+{
+ const OBJECT_NAME = 'tax.settings';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\SingletonRetrieve;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Update;
+}
diff --git a/lib/Stripe/lib/Tax/Transaction.php b/lib/Stripe/lib/Tax/Transaction.php
new file mode 100644
index 00000000..38fa97e5
--- /dev/null
+++ b/lib/Stripe/lib/Tax/Transaction.php
@@ -0,0 +1,89 @@
+Transaction records the tax collected from or refunded to
+ * your customer.
+ *
+ * @property string $id Unique identifier for the transaction.
+ * @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 string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
+ * @property null|string $customer The ID of an existing Customer used for the resource.
+ * @property \SimplePay\Vendor\Stripe\StripeObject $customer_details
+ * @property null|\SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> $line_items The tax collected or refunded, by line item.
+ * @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property string $reference A custom unique identifier, such as 'myOrder_123'.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $reversal If type=reversal
, contains information about what was reversed.
+ * @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation.
+ * @property string $type If reversal
, this transaction reverses an earlier transaction.
+ */
+class Transaction extends \SimplePay\Vendor\Stripe\ApiResource
+{
+ const OBJECT_NAME = 'tax.transaction';
+
+ use \SimplePay\Vendor\Stripe\ApiOperations\Create;
+ use \SimplePay\Vendor\Stripe\ApiOperations\Retrieve;
+
+ const TYPE_REVERSAL = 'reversal';
+ const TYPE_TRANSACTION = 'transaction';
+
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Tax\Transaction the created transaction
+ */
+ public static function createReversal($params = null, $opts = null)
+ {
+ $url = static::classUrl() . '/create_reversal';
+ list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
+ $obj = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+
+ /**
+ * @param string $id
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\LineItem> list of TaxProductResourceTaxTransactionLineItems
+ */
+ 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 = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Collection<\SimplePay\Vendor\Stripe\Tax\Transaction> list of TaxProductResourceTaxTransactions
+ */
+ public static function allTransactions($params = null, $opts = null)
+ {
+ $url = static::classUrl();
+ list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
+ $obj = \SimplePay\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
+ $obj->setLastResponse($response);
+
+ return $obj;
+ }
+}
diff --git a/lib/Stripe/lib/TaxId.php b/lib/Stripe/lib/TaxId.php
index d0418916..40255f17 100644
--- a/lib/Stripe/lib/TaxId.php
+++ b/lib/Stripe/lib/TaxId.php
@@ -18,7 +18,7 @@
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\SimplePay\Vendor\Stripe\Customer $customer ID of the customer.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
- * @property string $type Type of the tax ID, one of ae_trn
, au_abn
, au_arn
, bg_uic
, br_cnpj
, br_cpf
, ca_bn
, ca_gst_hst
, ca_pst_bc
, ca_pst_mb
, ca_pst_sk
, ca_qst
, ch_vat
, cl_tin
, es_cif
, eu_oss_vat
, eu_vat
, gb_vat
, ge_vat
, hk_br
, hu_tin
, id_npwp
, il_vat
, in_gst
, is_vat
, jp_cn
, jp_rn
, kr_brn
, li_uid
, mx_rfc
, my_frp
, my_itn
, my_sst
, no_vat
, nz_gst
, ru_inn
, ru_kpp
, sa_vat
, sg_gst
, sg_uen
, si_tin
, th_vat
, tw_vat
, ua_vat
, us_ein
, or za_vat
. Note that some legacy tax IDs have type unknown
+ * @property string $type Type of the tax ID, one of ae_trn
, au_abn
, au_arn
, bg_uic
, br_cnpj
, br_cpf
, ca_bn
, ca_gst_hst
, ca_pst_bc
, ca_pst_mb
, ca_pst_sk
, ca_qst
, ch_vat
, cl_tin
, eg_tin
, es_cif
, eu_oss_vat
, eu_vat
, gb_vat
, ge_vat
, hk_br
, hu_tin
, id_npwp
, il_vat
, in_gst
, is_vat
, jp_cn
, jp_rn
, jp_trn
, ke_pin
, kr_brn
, li_uid
, mx_rfc
, my_frp
, my_itn
, my_sst
, no_vat
, nz_gst
, ph_tin
, ru_inn
, ru_kpp
, sa_vat
, sg_gst
, sg_uen
, si_tin
, th_vat
, tr_tin
, tw_vat
, ua_vat
, us_ein
, or za_vat
. Note that some legacy tax IDs have type unknown
* @property string $value Value of the tax ID.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $verification Tax ID verification information.
*/
@@ -42,6 +42,7 @@ class TaxId extends ApiResource
const TYPE_CA_QST = 'ca_qst';
const TYPE_CH_VAT = 'ch_vat';
const TYPE_CL_TIN = 'cl_tin';
+ const TYPE_EG_TIN = 'eg_tin';
const TYPE_ES_CIF = 'es_cif';
const TYPE_EU_OSS_VAT = 'eu_oss_vat';
const TYPE_EU_VAT = 'eu_vat';
@@ -55,6 +56,8 @@ class TaxId extends ApiResource
const TYPE_IS_VAT = 'is_vat';
const TYPE_JP_CN = 'jp_cn';
const TYPE_JP_RN = 'jp_rn';
+ const TYPE_JP_TRN = 'jp_trn';
+ const TYPE_KE_PIN = 'ke_pin';
const TYPE_KR_BRN = 'kr_brn';
const TYPE_LI_UID = 'li_uid';
const TYPE_MX_RFC = 'mx_rfc';
@@ -63,6 +66,7 @@ class TaxId extends ApiResource
const TYPE_MY_SST = 'my_sst';
const TYPE_NO_VAT = 'no_vat';
const TYPE_NZ_GST = 'nz_gst';
+ const TYPE_PH_TIN = 'ph_tin';
const TYPE_RU_INN = 'ru_inn';
const TYPE_RU_KPP = 'ru_kpp';
const TYPE_SA_VAT = 'sa_vat';
@@ -70,6 +74,7 @@ class TaxId extends ApiResource
const TYPE_SG_UEN = 'sg_uen';
const TYPE_SI_TIN = 'si_tin';
const TYPE_TH_VAT = 'th_vat';
+ const TYPE_TR_TIN = 'tr_tin';
const TYPE_TW_VAT = 'tw_vat';
const TYPE_UA_VAT = 'ua_vat';
const TYPE_UNKNOWN = 'unknown';
diff --git a/lib/Stripe/lib/Terminal/Reader.php b/lib/Stripe/lib/Terminal/Reader.php
index a2aead93..74ce5d91 100644
--- a/lib/Stripe/lib/Terminal/Reader.php
+++ b/lib/Stripe/lib/Terminal/Reader.php
@@ -85,6 +85,23 @@ public function processSetupIntent($params = null, $opts = null)
return $this;
}
+ /**
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \SimplePay\Vendor\Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \SimplePay\Vendor\Stripe\Terminal\Reader the refunded reader
+ */
+ public function refundPayment($params = null, $opts = null)
+ {
+ $url = $this->instanceUrl() . '/refund_payment';
+ list($response, $opts) = $this->_request('post', $url, $params, $opts);
+ $this->refreshFrom($response, $opts);
+
+ return $this;
+ }
+
/**
* @param null|array $params
* @param null|array|string $opts
diff --git a/lib/Stripe/lib/Topup.php b/lib/Stripe/lib/Topup.php
index dbb89149..a386a338 100644
--- a/lib/Stripe/lib/Topup.php
+++ b/lib/Stripe/lib/Topup.php
@@ -24,7 +24,7 @@
* @property null|string $failure_message Message to user further explaining reason for top-up failure if available.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
- * @property \SimplePay\Vendor\Stripe\Source $source Source
objects allow you to accept a variety of payment methods. They represent a customer's payment instrument, and can be used with the SimplePay\Vendor\Stripe API just like a Card
object: once chargeable, they can be charged, or can be attached to customers.
Related guides: Sources API and Sources & Customers.
+ * @property null|\SimplePay\Vendor\Stripe\Source $source For most SimplePay\Vendor\Stripe users, the source of every top-up is a bank account. This hash is then the source object describing that bank account.
* @property null|string $statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter.
* @property string $status The status of the top-up is either canceled
, failed
, pending
, reversed
, or succeeded
.
* @property null|string $transfer_group A string that identifies this top-up as part of a group.
diff --git a/lib/Stripe/lib/Treasury/CreditReversal.php b/lib/Stripe/lib/Treasury/CreditReversal.php
index 2f6158d2..554f4ebe 100644
--- a/lib/Stripe/lib/Treasury/CreditReversal.php
+++ b/lib/Stripe/lib/Treasury/CreditReversal.php
@@ -13,6 +13,7 @@
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Amount (in cents) transferred.
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property string $financial_account The FinancialAccount to reverse funds from.
* @property null|string $hosted_regulatory_receipt_url A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
diff --git a/lib/Stripe/lib/Treasury/DebitReversal.php b/lib/Stripe/lib/Treasury/DebitReversal.php
index 4bc93cd1..b6b2c5ac 100644
--- a/lib/Stripe/lib/Treasury/DebitReversal.php
+++ b/lib/Stripe/lib/Treasury/DebitReversal.php
@@ -13,6 +13,7 @@
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Amount (in cents) transferred.
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property null|string $financial_account The FinancialAccount to reverse funds from.
* @property null|string $hosted_regulatory_receipt_url A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
diff --git a/lib/Stripe/lib/Treasury/OutboundTransfer.php b/lib/Stripe/lib/Treasury/OutboundTransfer.php
index 68ea3ec7..540c8532 100644
--- a/lib/Stripe/lib/Treasury/OutboundTransfer.php
+++ b/lib/Stripe/lib/Treasury/OutboundTransfer.php
@@ -23,13 +23,14 @@
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
- * @property string $destination_payment_method The PaymentMethod used as the payment instrument for an OutboundTransfer.
+ * @property null|string $destination_payment_method The PaymentMethod used as the payment instrument for an OutboundTransfer.
* @property \SimplePay\Vendor\Stripe\StripeObject $destination_payment_method_details
* @property int $expected_arrival_date The date when funds are expected to arrive in the destination account.
* @property string $financial_account The FinancialAccount that funds were pulled from.
* @property null|string $hosted_regulatory_receipt_url A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property \SimplePay\Vendor\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $network_details Details about the network used for the OutboundTransfer.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $returned_details Details about a returned OutboundTransfer. Only set when the status is returned
.
* @property string $statement_descriptor Information about the OutboundTransfer to be sent to the recipient account.
* @property string $status Current status of the OutboundTransfer: processing
, failed
, canceled
, posted
, returned
. An OutboundTransfer is processing
if it has been created and is pending. The status changes to posted
once the OutboundTransfer has been "confirmed" and funds have left the account, or to failed
or canceled
. If an OutboundTransfer fails to arrive at its destination, its status will change to returned
.
diff --git a/lib/Stripe/lib/Treasury/ReceivedCredit.php b/lib/Stripe/lib/Treasury/ReceivedCredit.php
index ea6f79f3..70cab553 100644
--- a/lib/Stripe/lib/Treasury/ReceivedCredit.php
+++ b/lib/Stripe/lib/Treasury/ReceivedCredit.php
@@ -23,6 +23,7 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $linked_flows
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property string $network The rails used to send the funds.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $network_details Details specific to the money movement rails.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $reversal_details Details describing when a ReceivedCredit may be reversed.
* @property string $status Status of the ReceivedCredit. ReceivedCredits are created either succeeded
(approved) or failed
(declined). If a ReceivedCredit is declined, the failure reason can be found in the failure_code
field.
* @property null|string|\SimplePay\Vendor\Stripe\Treasury\Transaction $transaction The Transaction associated with this object.
diff --git a/lib/Stripe/lib/Treasury/ReceivedDebit.php b/lib/Stripe/lib/Treasury/ReceivedDebit.php
index 77cfd2a5..14b06b8b 100644
--- a/lib/Stripe/lib/Treasury/ReceivedDebit.php
+++ b/lib/Stripe/lib/Treasury/ReceivedDebit.php
@@ -22,6 +22,7 @@
* @property \SimplePay\Vendor\Stripe\StripeObject $linked_flows
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property string $network The network used for the ReceivedDebit.
+ * @property null|\SimplePay\Vendor\Stripe\StripeObject $network_details Details specific to the money movement rails.
* @property null|\SimplePay\Vendor\Stripe\StripeObject $reversal_details Details describing when a ReceivedDebit might be reversed.
* @property string $status Status of the ReceivedDebit. ReceivedDebits are created with a status of either succeeded
(approved) or failed
(declined). The failure reason can be found under the failure_code
.
* @property null|string|\SimplePay\Vendor\Stripe\Treasury\Transaction $transaction The Transaction associated with this object.
diff --git a/lib/Stripe/lib/Util/ApiVersion.php b/lib/Stripe/lib/Util/ApiVersion.php
index 2259e89d..08503dab 100644
--- a/lib/Stripe/lib/Util/ApiVersion.php
+++ b/lib/Stripe/lib/Util/ApiVersion.php
@@ -6,5 +6,5 @@
class ApiVersion
{
- const CURRENT = '2022-08-01';
+ const CURRENT = '2022-11-15';
}
diff --git a/lib/Stripe/lib/Util/ObjectTypes.php b/lib/Stripe/lib/Util/ObjectTypes.php
index e9e61d35..12654efc 100644
--- a/lib/Stripe/lib/Util/ObjectTypes.php
+++ b/lib/Stripe/lib/Util/ObjectTypes.php
@@ -12,6 +12,7 @@ class ObjectTypes
const mapping = [
\SimplePay\Vendor\Stripe\Account::OBJECT_NAME => \SimplePay\Vendor\Stripe\Account::class,
\SimplePay\Vendor\Stripe\AccountLink::OBJECT_NAME => \SimplePay\Vendor\Stripe\AccountLink::class,
+ \SimplePay\Vendor\Stripe\AccountSession::OBJECT_NAME => \SimplePay\Vendor\Stripe\AccountSession::class,
\SimplePay\Vendor\Stripe\ApplePayDomain::OBJECT_NAME => \SimplePay\Vendor\Stripe\ApplePayDomain::class,
\SimplePay\Vendor\Stripe\ApplicationFee::OBJECT_NAME => \SimplePay\Vendor\Stripe\ApplicationFee::class,
\SimplePay\Vendor\Stripe\ApplicationFeeRefund::OBJECT_NAME => \SimplePay\Vendor\Stripe\ApplicationFeeRefund::class,
@@ -22,6 +23,9 @@ class ObjectTypes
\SimplePay\Vendor\Stripe\BillingPortal\Configuration::OBJECT_NAME => \SimplePay\Vendor\Stripe\BillingPortal\Configuration::class,
\SimplePay\Vendor\Stripe\BillingPortal\Session::OBJECT_NAME => \SimplePay\Vendor\Stripe\BillingPortal\Session::class,
\SimplePay\Vendor\Stripe\Capability::OBJECT_NAME => \SimplePay\Vendor\Stripe\Capability::class,
+ \SimplePay\Vendor\Stripe\Capital\FinancingOffer::OBJECT_NAME => \SimplePay\Vendor\Stripe\Capital\FinancingOffer::class,
+ \SimplePay\Vendor\Stripe\Capital\FinancingSummary::OBJECT_NAME => \SimplePay\Vendor\Stripe\Capital\FinancingSummary::class,
+ \SimplePay\Vendor\Stripe\Capital\FinancingTransaction::OBJECT_NAME => \SimplePay\Vendor\Stripe\Capital\FinancingTransaction::class,
\SimplePay\Vendor\Stripe\Card::OBJECT_NAME => \SimplePay\Vendor\Stripe\Card::class,
\SimplePay\Vendor\Stripe\CashBalance::OBJECT_NAME => \SimplePay\Vendor\Stripe\CashBalance::class,
\SimplePay\Vendor\Stripe\Charge::OBJECT_NAME => \SimplePay\Vendor\Stripe\Charge::class,
@@ -33,6 +37,7 @@ class ObjectTypes
\SimplePay\Vendor\Stripe\CreditNoteLineItem::OBJECT_NAME => \SimplePay\Vendor\Stripe\CreditNoteLineItem::class,
\SimplePay\Vendor\Stripe\Customer::OBJECT_NAME => \SimplePay\Vendor\Stripe\Customer::class,
\SimplePay\Vendor\Stripe\CustomerBalanceTransaction::OBJECT_NAME => \SimplePay\Vendor\Stripe\CustomerBalanceTransaction::class,
+ \SimplePay\Vendor\Stripe\CustomerCashBalanceTransaction::OBJECT_NAME => \SimplePay\Vendor\Stripe\CustomerCashBalanceTransaction::class,
\SimplePay\Vendor\Stripe\Discount::OBJECT_NAME => \SimplePay\Vendor\Stripe\Discount::class,
\SimplePay\Vendor\Stripe\Dispute::OBJECT_NAME => \SimplePay\Vendor\Stripe\Dispute::class,
\SimplePay\Vendor\Stripe\EphemeralKey::OBJECT_NAME => \SimplePay\Vendor\Stripe\EphemeralKey::class,
@@ -44,8 +49,12 @@ class ObjectTypes
\SimplePay\Vendor\Stripe\FinancialConnections\Account::OBJECT_NAME => \SimplePay\Vendor\Stripe\FinancialConnections\Account::class,
\SimplePay\Vendor\Stripe\FinancialConnections\AccountOwner::OBJECT_NAME => \SimplePay\Vendor\Stripe\FinancialConnections\AccountOwner::class,
\SimplePay\Vendor\Stripe\FinancialConnections\AccountOwnership::OBJECT_NAME => \SimplePay\Vendor\Stripe\FinancialConnections\AccountOwnership::class,
+ \SimplePay\Vendor\Stripe\FinancialConnections\InferredBalance::OBJECT_NAME => \SimplePay\Vendor\Stripe\FinancialConnections\InferredBalance::class,
\SimplePay\Vendor\Stripe\FinancialConnections\Session::OBJECT_NAME => \SimplePay\Vendor\Stripe\FinancialConnections\Session::class,
+ \SimplePay\Vendor\Stripe\FinancialConnections\Transaction::OBJECT_NAME => \SimplePay\Vendor\Stripe\FinancialConnections\Transaction::class,
\SimplePay\Vendor\Stripe\FundingInstructions::OBJECT_NAME => \SimplePay\Vendor\Stripe\FundingInstructions::class,
+ \SimplePay\Vendor\Stripe\GiftCards\Card::OBJECT_NAME => \SimplePay\Vendor\Stripe\GiftCards\Card::class,
+ \SimplePay\Vendor\Stripe\GiftCards\Transaction::OBJECT_NAME => \SimplePay\Vendor\Stripe\GiftCards\Transaction::class,
\SimplePay\Vendor\Stripe\Identity\VerificationReport::OBJECT_NAME => \SimplePay\Vendor\Stripe\Identity\VerificationReport::class,
\SimplePay\Vendor\Stripe\Identity\VerificationSession::OBJECT_NAME => \SimplePay\Vendor\Stripe\Identity\VerificationSession::class,
\SimplePay\Vendor\Stripe\Invoice::OBJECT_NAME => \SimplePay\Vendor\Stripe\Invoice::class,
@@ -71,6 +80,7 @@ class ObjectTypes
\SimplePay\Vendor\Stripe\Product::OBJECT_NAME => \SimplePay\Vendor\Stripe\Product::class,
\SimplePay\Vendor\Stripe\PromotionCode::OBJECT_NAME => \SimplePay\Vendor\Stripe\PromotionCode::class,
\SimplePay\Vendor\Stripe\Quote::OBJECT_NAME => \SimplePay\Vendor\Stripe\Quote::class,
+ \SimplePay\Vendor\Stripe\QuotePhase::OBJECT_NAME => \SimplePay\Vendor\Stripe\QuotePhase::class,
\SimplePay\Vendor\Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \SimplePay\Vendor\Stripe\Radar\EarlyFraudWarning::class,
\SimplePay\Vendor\Stripe\Radar\ValueList::OBJECT_NAME => \SimplePay\Vendor\Stripe\Radar\ValueList::class,
\SimplePay\Vendor\Stripe\Radar\ValueListItem::OBJECT_NAME => \SimplePay\Vendor\Stripe\Radar\ValueListItem::class,
@@ -83,12 +93,15 @@ class ObjectTypes
\SimplePay\Vendor\Stripe\SetupIntent::OBJECT_NAME => \SimplePay\Vendor\Stripe\SetupIntent::class,
\SimplePay\Vendor\Stripe\ShippingRate::OBJECT_NAME => \SimplePay\Vendor\Stripe\ShippingRate::class,
\SimplePay\Vendor\Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \SimplePay\Vendor\Stripe\Sigma\ScheduledQueryRun::class,
- \SimplePay\Vendor\Stripe\SKU::OBJECT_NAME => \SimplePay\Vendor\Stripe\SKU::class,
\SimplePay\Vendor\Stripe\Source::OBJECT_NAME => \SimplePay\Vendor\Stripe\Source::class,
\SimplePay\Vendor\Stripe\SourceTransaction::OBJECT_NAME => \SimplePay\Vendor\Stripe\SourceTransaction::class,
\SimplePay\Vendor\Stripe\Subscription::OBJECT_NAME => \SimplePay\Vendor\Stripe\Subscription::class,
\SimplePay\Vendor\Stripe\SubscriptionItem::OBJECT_NAME => \SimplePay\Vendor\Stripe\SubscriptionItem::class,
\SimplePay\Vendor\Stripe\SubscriptionSchedule::OBJECT_NAME => \SimplePay\Vendor\Stripe\SubscriptionSchedule::class,
+ \SimplePay\Vendor\Stripe\Tax\Calculation::OBJECT_NAME => \SimplePay\Vendor\Stripe\Tax\Calculation::class,
+ \SimplePay\Vendor\Stripe\Tax\Registration::OBJECT_NAME => \SimplePay\Vendor\Stripe\Tax\Registration::class,
+ \SimplePay\Vendor\Stripe\Tax\Settings::OBJECT_NAME => \SimplePay\Vendor\Stripe\Tax\Settings::class,
+ \SimplePay\Vendor\Stripe\Tax\Transaction::OBJECT_NAME => \SimplePay\Vendor\Stripe\Tax\Transaction::class,
\SimplePay\Vendor\Stripe\TaxCode::OBJECT_NAME => \SimplePay\Vendor\Stripe\TaxCode::class,
\SimplePay\Vendor\Stripe\TaxId::OBJECT_NAME => \SimplePay\Vendor\Stripe\TaxId::class,
\SimplePay\Vendor\Stripe\TaxRate::OBJECT_NAME => \SimplePay\Vendor\Stripe\TaxRate::class,
diff --git a/lib/Stripe/lib/Util/Util.php b/lib/Stripe/lib/Util/Util.php
index 11b3ef2a..53eed108 100644
--- a/lib/Stripe/lib/Util/Util.php
+++ b/lib/Stripe/lib/Util/Util.php
@@ -74,7 +74,7 @@ public static function convertToStripeObject($resp, $opts)
public static function utf8($value)
{
if (null === self::$isMbstringAvailable) {
- self::$isMbstringAvailable = \function_exists('mb_detect_encoding');
+ self::$isMbstringAvailable = \function_exists('mb_detect_encoding') && \function_exists('mb_convert_encoding');
if (!self::$isMbstringAvailable) {
\trigger_error('It looks like the mbstring extension is not enabled. ' .
@@ -85,7 +85,7 @@ public static function utf8($value)
}
if (\is_string($value) && self::$isMbstringAvailable && 'UTF-8' !== \mb_detect_encoding($value, 'UTF-8', true)) {
- return \utf8_encode($value);
+ return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
}
return $value;
diff --git a/package.json b/package.json
index dd56b20a..5947eaa5 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "wp-simple-pay-lite",
"title": "WP Simple Pay Lite for Stripe",
"description": "Add high conversion Stripe Checkout forms to your WordPress site and start accepting payments in minutes. **Lite Version**",
- "version": "4.6.7",
+ "version": "4.7.0",
"license": "GPL-2.0-or-later",
"homepage": "https://wpsimplepay.com/",
"repository": {
diff --git a/readme.txt b/readme.txt
index 224ffab5..aad3aaa4 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Contributors: wpsimplepay, pderksen, spencerfinnell, adamjlea, mordauk, cklosows
Tags: stripe, stripe checkout, stripe payments, credit card payments, stripe gateway
Requires at least: 5.2
Tested up to: 6.1
-Stable tag: 4.6.7
+Stable tag: 4.7.0
Requires PHP: 5.6
License: GPLv2 or later
@@ -59,127 +59,22 @@ If you need more functionality for your Stripe credit card forms, you can [upgra
- Coupon duration settings
- Buy Now, Pay Later with Klarna & Afterpay/Clearpay
-> **WP Simple Pay Pro - Stripe Payment Forms**
-> This plugin is the lite version of the WP Simple Pay Pro plugin that comes with many payment features including custom fields, user-entered amounts, coupon codes, tax rates, recurring payments (aka subscriptions), alternate payment methods, ACH, direct debit, Buy Now Pay Later and tons more. [Click here to purchase the best Stripe payment forms and Stripe payments plugin now!](https://wpsimplepay.com/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-By upgrading to WP Simple Pay Pro, you also get access to one-on-one help from our knowledgeable support team and our extensive documentation site.
-
-> WP Simple Pay has been a game changer for my business. There is no simpler way to accept credit card payments with Stripe on your site. We offer subscriptions with setup fees and this plugin handled these needs beautifully. Their support is unrivaled too.
-
-> Brian Casel, Founder of Audience Ops
-
-There is a small 3% credit card fee per-transaction plus Stripe fees while using WP Simple Pay Lite. [Upgrade to Pro](https://wpsimplepay.com/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link) for no added credit card form fees and priority support.
-
WP Simple Pay is a verified member of the Stripe partner program. This program recognizes software that meets Stripe's strict quality requirements and provides users of WP Simple Pay and Stripe with the confidence they need to trust us both with their payment form integrations.
Below are a few examples of ways you can set up Stripe payment and credit card forms with WP Simple Pay. [See our payment form templates](https://wpsimplepay.com/templates/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link) to try them out for yourself.
-=== 💳 Payment Form Drag & Drop Builder ===
-
-Drag and drop to add a custom amount entry, a coupon code field, various custom field types, subscription plan selection, a payment summary and more.
-
-All data entered into these custom payment fields are stored as "metadata" with each Stripe payment record within your Stripe dashboard, so everything is viewable alongside all payment or subscription plan data.
-
-[View our custom fields template](https://wpsimplepay.com/templates/custom-fields-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-=== 💳 3 Payment Form Display Types ===
-
-Select from the on-site embedded, on-site overlay, or Stripe Checkout payment form display types.
-
-Compare them by viewing some of our payment form templates:
-
-- [Embedded on-site payment form](https://wpsimplepay.com/templates/credit-card-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [Overlay on-site payment form](https://wpsimplepay.com/templates/overlay-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [Stripe Checkout](https://wpsimplepay.com/templates/stripe-checkout-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-=== 💳 Use Stripe Checkout Payment Form Pages ===
-
-If you need only minimal payment form customizations and don't need an overlay payment form, you can utilize Stripe's fully-hosted checkout pages to accept credit card payments. You can set a few options when using Stripe Checkout, but when this option is selected, Stripe dictates what can and cannot be configured on the checkout page as it is served up by Stripe’s servers.
-
-[View our Stripe Checkout template](https://wpsimplepay.com/templates/stripe-checkout-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-> We paid developers for several hours to do what WP Simple Pay accomplished in minutes. A no-brainer investment for us.
-
-> Justin McGill, Founder of LeadFuze
-
-=== 💳 Allow Custom Credit Card Payment Amounts ===
-
-Set a one-time credit card payment amount or let your site visitors pay what they want. Optionally specify minimum and default amounts.
-
-[View our one-time custom amount template](https://wpsimplepay.com/templates/one-time-custom-amount-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-=== 💳 Add and Customize Subscription Options in Stripe ===
-
-Connect a payment button to an individual Stripe plan or let your site visitors pick a plan to subscribe to. Add a custom amount option, charge a setup fee or tie into free trials.
-
-View a few of these subscription templates:
-
-- [Opt-in to recurring subscription payments](https://wpsimplepay.com/templates/opt-in-subscription-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [Allow customer or donor to enter a recurring custom amount](https://wpsimplepay.com/templates/subscription-custom-amount-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [Add an initial setup fee to the first payment](https://wpsimplepay.com/templates/subscription-setup-fee-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-You can also set up installment plans to end subscriptions after a specific number of charges.
-
-=== 💳 Offer Discounts with Coupon Codes in Stripe ===
-
-Percent or amount-off coupon codes added in your Stripe dashboard can be used in your payment forms.
-
-Use with subscriptions or one-time payments, and optionally add a total amount label that updates real-time.
-
-[View our coupon code template](https://wpsimplepay.com/templates/coupon-code-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-> I've set up payment processing on over a dozen sites and it usually takes forever just to get up and running. Using WP Simple Pay I was accepting Stripe payments in no time. It’s one of the best decisions I made while launching my new product.
-
-> Mike Taber, Founder of Bluetick
-
-=== 💳 Add Apple Pay and Google Pay Buttons to Stripe Payment forms ===
-
-Give your site visitors the option to pay using Apple Pay, Google Pay, and Microsoft Pay with a single button in your custom embedded or overlay payment forms.
-
-Anyone with a browser and device combination that allows one of these options will see the new payment button.
-
-[View our Apple Pay & Google Pay template](https://wpsimplepay.com/templates/apple-pay-google-pay-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-=== 💳 Accept ACH Debit Payments with Stripe ===
-
-Give your U.S. customers the option to pay directly from their bank accounts with ACH debit payments and take advantage of lower fees in Stripe. ACH payments on Stripe cost 0.80%, capped at $5, with no monthly fees or verification fees.
-
-[View our ACH debit payment template](https://wpsimplepay.com/templates/ach-direct-debit-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-=== 💳 Accept Buy Now, Pay Later Payments with Klarna and Afterpay/Clearpay ===
-
-With a buy now, pay later payment method enabled, your customers get more payment flexibility, allowing them to purchase what they want now and pay over time. Your business receives the full payment upfront and is protected from fraud, while your customers pay nothing or only a portion of the total upfront without fees.
-
-[View our Klarna buy now, pay later template](https://wpsimplepay.com/templates/klarna-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-[View our Afterpay/Clearpay buy now, pay later template](https://wpsimplepay.com/templates/afterpay-clearpay-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-=== 💳 More Alternative Payment Methods with Stripe ===
-
-Even more alternative payment methods for your credit card payment forms are supported by WP Simple Pay and Stripe. Check out these templates:
-
-- [iDEAL](https://wpsimplepay.com/templates/ideal-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [SEPA Direct Debit](https://wpsimplepay.com/templates/sepa-direct-debit-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [Alipay](https://wpsimplepay.com/templates/alipay-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [Bancontact](https://wpsimplepay.com/templates/bancontact-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [giropay](https://wpsimplepay.com/templates/giropay-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- [Przelewy24](https://wpsimplepay.com/templates/przelewy24-payment-form/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-- FPX
-
-=== 💳 Customized Payment Confirmation Details with Stripe ===
-
-Easily customize the credit card payment confirmation details your customers see within the post editor using placeholder tags.
-
-[Learn more about customizable receipts](https://wpsimplepay.com/features/payment-receipts/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link) to see it in action.
-
-=== 💳 Locale and Currency Settings in Stripe ===
-
-Stripe currently supports 30+ languages, 45+ countries, and 135+ currencies. WP Simple Pay lets you set the locale (language) for your payment forms as well as the preferred currency and date formats for your site's region.
-
-[Learn more about locales](https://wpsimplepay.com/features/payment-methods/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link)
-
-> The WP Simple Pay team has been outstanding. From technical support to feature requests to frequent product updates – the value provided has saved us thousands over building a Stripe integration ourselves.
-
-> Jon MacDonald, Founder of The Good
+- Payment Form Drag & Drop Builder
+- Select from the on-site embedded, on-site overlay, or Stripe Checkout payment form display types
+- Use Stripe Checkout Payment Form Pages
+- Allow Custom Credit Card Payment Amounts
+- Add and Customize Subscription Options in Stripe
+- Offer Discounts with Coupon Codes in Stripe
+- Add Apple Pay and Google Pay Buttons to Stripe Payment forms
+- Accept ACH Debit Payments with Stripe
+- Accept Buy Now, Pay Later Payments with Klarna and Afterpay/Clearpay
+- More Alternative Payment Methods with Stripe
+- Customized Payment Confirmation Details with Stripe
+- Locale and Currency Settings in Stripe
=== 📧 Get Help ===
@@ -206,7 +101,6 @@ If you like our Stripe payment form plugin, then consider checking out our other
Visit [WPBeginner](https://www.wpbeginner.com/) to learn from our [WordPress Tutorials](https://www.wpbeginner.com/category/wp-tutorials/) and find out about other [best WordPress plugins](https://www.wpbeginner.com/category/plugins/).
-
== Installation ==
The easiest way to install WP Simple Pay is to search for it via your site’s Dashboard.
@@ -222,7 +116,7 @@ The easiest way to install WP Simple Pay is to search for it via your site’s D
If you prefer installing manually you can [download the plugin ZIP file here](https://downloads.wordpress.org/plugin/stripe.latest-stable.zip).
-Additional documentation at [docs.wpsimplepay.com](https://docs.wpsimplepay.com/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link).
+Additional documentation at [wpsimplepay.com/docs](https://wpsimplepay.com/docs/?utm_source=wporg&utm_campaign=lite-plugin&utm_medium=link).
== Frequently Asked Questions ==
@@ -284,6 +178,13 @@ No. WP Simple Pay is a standalone Stripe payments plugin and does not integrate
== Changelog ==
+= Stripe Payment Forms v4.7.0 - February 28, 2023 =
+
+* Fix: Ensure text after dynamic {{amount}} tag is visible on payment buttons.
+* Dev: Reduce the amount of JavaScript files included on the page.
+* Dev: Update to Stripe API version 2022-11-15.
+* Dev: Update the Stripe API PHP library to 10.6.0.
+
= Stripe Payment Forms v4.6.7 - January 24, 2023 =
* New "Activity & Reports" - see an overview of latest activity and filterable reports.
@@ -313,8 +214,3 @@ No. WP Simple Pay is a standalone Stripe payments plugin and does not integrate
* New: Add additional payment form templates.
* New: Payment Confirmation - add `simpay_payment_receipt_viewed` hook.
-
-= Stripe Payment Forms v4.6.2 - October 19, 2022 =
-
-* New: Add additional payment form templates.
-* New: Update UI for global anti-spam settings in the form builder.
diff --git a/src/Admin/SiteHealth/SiteHealthDebugInformation.php b/src/Admin/SiteHealth/SiteHealthDebugInformation.php
index 5f830449..a81bd5ce 100644
--- a/src/Admin/SiteHealth/SiteHealthDebugInformation.php
+++ b/src/Admin/SiteHealth/SiteHealthDebugInformation.php
@@ -152,6 +152,20 @@ private function get_test_or_live_mode() {
: __( 'Live Mode', 'stripe' );
}
+ /**
+ * Returns "Yes" or "No" depending on if UPE is being used
+ *
+ * @since 4.7.0
+ *
+ * @return string
+ */
+ private function get_upe_yes_or_upe_no() {
+ return simpay_is_upe()
+ ? __( 'Yes', 'stripe' )
+ : __( 'No', 'stripe' );
+ }
+
+
/**
* Returns the CAPTCHA type.
*
@@ -444,6 +458,10 @@ public function debug_information( $debug_info ) {
'label' => __( 'Webhook Secret', 'stripe' ),
'value' => $this->get_webhook_secret(),
),
+ 'upe' => array(
+ 'label' => __( 'Using UPE', 'stripe' ),
+ 'value' => $this->get_upe_yes_or_upe_no(),
+ ),
),
);
diff --git a/src/AntiSpam/EmailVerification.php b/src/AntiSpam/EmailVerification.php
index 5d366c8a..0891f118 100644
--- a/src/AntiSpam/EmailVerification.php
+++ b/src/AntiSpam/EmailVerification.php
@@ -118,7 +118,8 @@ public function get_subscribed_events() {
// Use a cleaned version of the submitted email address as the rate
// limiter ID. spencer+123@gmail.com turns in to spencer@gmail.com.
- $subscribers['simpay_rate_limiting_id'] = 'set_rate_limiting_id';
+ $subscribers['simpay_rate_limiting_id'] =
+ array( 'set_rate_limiting_id', 10, 2 );
// ... and extend the rate limiting window.
$subscribers['simpay_rate_limiting_timeout'] =
@@ -747,24 +748,34 @@ public function remove_verification_code( $verification_code ) {
*
* @since 4.6.0
*
- * @param string $id The rate limiting ID.
+ * @param string $id The rate limiting ID.
+ * @param \WP_REST_Request $request The REST API request.
* @return string
*/
- public function set_rate_limiting_id( $id ) {
- if (
- ! isset(
- $_POST['form_values'],
- $_POST['form_values']['simpay_email_verification_code']
- )
- ) {
- return $id;
- }
+ public function set_rate_limiting_id( $id, $request ) {
+ if ( ! empty( $request->get_param('form_values') ) ) {
+ /** @var array $form_values */
+ $form_values = $request->get_param('form_values');
+
+ if ( ! isset( $form_values['simpay_email_verification_code'] ) ) {
+ return $id;
+ }
+
+ $email = $form_values['simpay_email'];
+ } else {
+ if (
+ ! isset(
+ $_POST['form_values'],
+ $_POST['form_values']['simpay_email_verification_code']
+ )
+ ) {
+ return $id;
+ }
- $email = sanitize_text_field(
- $_POST['form_values']['simpay_email']
- );
+ $email = $_POST['form_values']['simpay_email'];
+ }
- return $this->clean_email( $email );
+ return $this->clean_email( sanitize_text_field( $email ) );
}
/**
diff --git a/src/AntiSpam/RequireAuthentication.php b/src/AntiSpam/RequireAuthentication.php
index 65fd3205..244ab431 100644
--- a/src/AntiSpam/RequireAuthentication.php
+++ b/src/AntiSpam/RequireAuthentication.php
@@ -51,6 +51,9 @@ public function get_subscribed_events() {
foreach ( $actions as $action ) {
$subscribers[ $action ] = array( 'requre_authentication', 0 );
}
+
+ $subscribers['simpay_rate_limiting_id'] =
+ array( 'set_rate_limiting_id', 10, 2 );
}
return $subscribers;
@@ -136,4 +139,21 @@ public function requre_authentication() {
__( 'Please log in to make a payment.', 'stripe' )
);
}
+
+ /**
+ * Updates the rate limiting ID to use the user ID if the user is logged in.
+ *
+ * @since 4.7.0
+ *
+ * @param string $id The rate limiting ID.
+ * @param \WP_REST_Request $request The payment request.
+ * @return int|string The user ID if the user is logged in, otherwise the rate limiting ID.
+ */
+ public function set_rate_limiting_id( $id, $request ) {
+ if ( is_user_logged_in() ) {
+ $id = get_current_user_id();
+ }
+
+ return $id;
+ }
}
diff --git a/src/Block/ButtonBlock.php b/src/Block/ButtonBlock.php
index ff05d0de..5e2f08b6 100644
--- a/src/Block/ButtonBlock.php
+++ b/src/Block/ButtonBlock.php
@@ -145,7 +145,7 @@ private function is_form_type_valid( $form_id ) {
$custom_fields = simpay_get_saved_meta(
$form_id,
'_custom_fields',
- array() // @phpstan-ignore-line
+ array()
);
$_custom_fields = array();
diff --git a/src/Block/PaymentFormBlock.php b/src/Block/PaymentFormBlock.php
index 9a858010..7142c188 100644
--- a/src/Block/PaymentFormBlock.php
+++ b/src/Block/PaymentFormBlock.php
@@ -172,6 +172,7 @@ private function register_assets( $asset_file ) {
'simpay-block-payment-form',
'simpayBlockPaymentForm',
array(
+ 'isUpe' => simpay_is_upe(),
'isLite' => $this->license->is_lite() ? 1 : 0,
'previews' => array(
'pro' => SIMPLE_PAY_INC_URL . '/core/assets/images/blocks/payment-form-preview-pro.png', // @phpstan-ignore-line
@@ -193,7 +194,7 @@ private function register_assets( $asset_file ) {
/**
* Returns a list of variables used to manually initialize the payment form in the block editor.
*
- * This list is messy, weird, and confusing. You are not crazy. It is a way to simulate the
+ * The non-UPE is messy, weird, and confusing. You are not crazy. It is a way to simulate the
* form of the `var simplePayForms = []` script data normally output on the frontend.
*
* @link https://github.com/awesomemotive/wp-simple-pay-pro/issues/860
@@ -204,31 +205,41 @@ private function register_assets( $asset_file ) {
* @return array
*/
private function get_form_vars( $form ) {
- $vars = array(
- 'id' => $form->id,
- 'type' => 'stripe_checkout' === $form->get_display_type()
- ? 'stripe-checkout'
- : 'stripe-elements',
- 'form' => $form->get_form_script_variables(), // @phpstan-ignore-line
- 'stripe' => array_merge(
- array(
- 'amount' => $form->total_amount, // @phpstan-ignore-line
- 'country' => $form->country,
+ $is_lite = $this->license->is_lite();
+
+ /** @var \SimplePay\Core\Forms\Default_Form $form */
+
+ if ( simpay_is_upe() ) {
+ $vars = $form->get_upe_script_variables();
+ } else {
+ $vars = array(
+ 'id' => $form->id,
+ 'type' => 'stripe_checkout' === $form->get_display_type()
+ ? 'stripe-checkout'
+ : 'stripe-elements',
+ 'form' => $form->get_form_script_variables(),
+ 'stripe' => array_merge(
+ array(
+ 'amount' => $form->total_amount,
+ 'country' => $form->country,
+ ),
+ $form->get_stripe_script_variables()
),
- $form->get_stripe_script_variables()
- ),
- );
+ );
- if ( false === $this->license->is_lite() ) {
- $temp = array();
- $temp[ $form->id ] = $vars;
+ if ( false === $is_lite ) {
+ $temp = array();
+ $temp[ $form->id ] = $vars;
- $pro = $form->pro_get_form_script_variables( $temp, $form->id ); // @phpstan-ignore-line
+ /** @var \SimplePay\Pro\Forms\Pro_Form $form */
- $vars = wp_parse_args(
- $vars['form'],
- $pro[ $form->id ]
- );
+ $pro = $form->pro_get_form_script_variables( $temp, $form->id );
+
+ $vars = wp_parse_args(
+ $vars['form'],
+ $pro[ $form->id ]
+ );
+ }
}
return $vars;
diff --git a/src/Integration/Divi/ExtensionSubscriber.php b/src/Integration/Divi/ExtensionSubscriber.php
index 302f7e7c..54a61c16 100644
--- a/src/Integration/Divi/ExtensionSubscriber.php
+++ b/src/Integration/Divi/ExtensionSubscriber.php
@@ -437,7 +437,7 @@ private function is_form_type_valid( $form_id ) {
$custom_fields = simpay_get_saved_meta(
$form_id,
'_custom_fields',
- array() // @phpstan-ignore-line
+ array()
);
$_custom_fields = array();
diff --git a/src/Integration/Elementor/PaymentFormControl.php b/src/Integration/Elementor/PaymentFormControl.php
index 8812d970..dbfd9acf 100644
--- a/src/Integration/Elementor/PaymentFormControl.php
+++ b/src/Integration/Elementor/PaymentFormControl.php
@@ -161,7 +161,7 @@ private function is_form_type_valid( $form_id ) {
$custom_fields = simpay_get_saved_meta(
$form_id,
'_custom_fields',
- array() // @phpstan-ignore-line
+ array()
);
$_custom_fields = array();
diff --git a/src/License/License.php b/src/License/License.php
index ec9df072..96d74510 100644
--- a/src/License/License.php
+++ b/src/License/License.php
@@ -407,7 +407,9 @@ public function is_enhanced_subscriptions_enabled() {
* @return bool
*/
public function is_lite() {
- $is_lite = ! class_exists( '\SimplePay\Pro\SimplePayPro', false );
+ $is_lite = ! file_exists(
+ trailingslashit( SIMPLE_PAY_INC ) . 'pro/class-simplepaypro.php' // @phpstan-ignore-line
+ );
/**
* Filters whether the current environment is Lite or not.
diff --git a/src/RestApi/Internal/Payment/AbstractPaymentCreateRoute.php b/src/RestApi/Internal/Payment/AbstractPaymentCreateRoute.php
new file mode 100644
index 00000000..39c2bb36
--- /dev/null
+++ b/src/RestApi/Internal/Payment/AbstractPaymentCreateRoute.php
@@ -0,0 +1,77 @@
+application_fee = $application_fee;
+ }
+
+ /**
+ * Determines if the current request should be able to create a payment.
+ *
+ * This occurs _before_ argument validation is done. This should be where
+ * user authentication permission checks are done.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return bool
+ */
+ public function create_payment_permissions_check( $request ) {
+ return true;
+ }
+
+ /**
+ * Creates a payment for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return \WP_REST_Response
+ */
+ abstract public function create_payment( $request );
+
+}
diff --git a/src/RestApi/Internal/Payment/AbstractPaymentRoute.php b/src/RestApi/Internal/Payment/AbstractPaymentRoute.php
new file mode 100644
index 00000000..381a3126
--- /dev/null
+++ b/src/RestApi/Internal/Payment/AbstractPaymentRoute.php
@@ -0,0 +1,83 @@
+ 'register_route',
+ );
+ }
+
+ /**
+ * Registers the REST API routes for the endpoint.
+ *
+ * @since 4.7.0
+ *
+ * @return void
+ */
+ abstract public function register_route();
+
+ /**
+ * Determines if the REST API request is valid based on the current rate limit.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return bool
+ */
+ protected function validate_rate_limit( $request ) {
+ if ( current_user_can( 'manage_options' ) ) {
+ return true;
+ }
+
+ $has_exceeded_rate_limit = false;
+
+ /**
+ * Filters if the current IP address has exceeded the rate limit.
+ *
+ * @since 3.9.5
+ * @since 4.7.0 Added $request parameter.
+ *
+ * @param bool $has_exceeded_rate_limit
+ * @param \WP_REST_Request $request The payment request.
+ */
+ $has_exceeded_rate_limit = apply_filters(
+ 'simpay_has_exceeded_rate_limit',
+ $has_exceeded_rate_limit,
+ $request
+ );
+
+ return ! $has_exceeded_rate_limit;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Exception/ValidationException.php b/src/RestApi/Internal/Payment/Exception/ValidationException.php
new file mode 100644
index 00000000..221330b1
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Exception/ValidationException.php
@@ -0,0 +1,23 @@
+ WP_REST_Server::CREATABLE,
+ 'callback' => array( $this, 'create_payment' ),
+ 'permission_callback' => array(
+ $this,
+ 'create_payment_permissions_check',
+ ),
+ 'args' => array(
+ 'form_id' => SchemaUtils::get_form_id_schema(),
+ 'price_id' => SchemaUtils::get_price_id_schema(),
+ 'quantity' => SchemaUtils::get_quantity_schema(),
+ 'token' => SchemaUtils::get_token_schema(),
+ ),
+ );
+
+ register_rest_route(
+ $this->namespace,
+ $this->route,
+ $create_item_route
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @throws \Simplepay\Core\RestApi\Internal\Payment\Exception\ValidationException If a validation error occurs.
+ */
+ public function create_payment( $request ) {
+ try {
+ // Check rate limit.
+ // This is done here to avoid double increments (in authorization callback)
+ // or non-human-friendly error messages (in API argument validation).
+ if ( false === $this->validate_rate_limit( $request ) ) {
+ throw new ValidationException(
+ __(
+ 'Sorry, you have made too many requests. Please try again later.',
+ 'stripe'
+ )
+ );
+ }
+
+ // Check form token.
+ if ( false === TokenValidationUtils::validate_token( $request ) ) {
+ throw new ValidationException(
+ __( 'Invalid CAPTCHA. Please try again.', 'stripe' )
+ );
+ }
+
+ $payment = $this->create_checkout_session(
+ $request,
+ $this->get_checkout_session_args( $request, null )
+ );
+
+ return new WP_REST_Response(
+ array(
+ 'redirect' => $payment->url,
+ )
+ );
+ } catch ( ValidationException $e ) {
+ return new WP_REST_Response(
+ array(
+ 'message' => Utils\handle_exception_message( $e ),
+ ),
+ rest_authorization_required_code()
+ );
+ } catch ( Exception $e ) {
+ return new WP_REST_Response(
+ array(
+ 'message' => Utils\handle_exception_message( $e ),
+ ),
+ 400
+ );
+ }
+ }
+
+ /**
+ * Returns arguments used to create a Checkout Session.
+ *
+ * These arguments are available in both Lite and Pro.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @param null|\SimplePay\Vendor\Stripe\Customer $customer The Stripe customer.
+ * @return array
+ */
+ protected function get_checkout_session_args( $request, $customer ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $price = PaymentRequestUtils::get_price( $request );
+ $quantity = PaymentRequestUtils::get_quantity( $request );
+
+ $session_args = array(
+ 'customer_creation' => 'always',
+ 'locale' => $form->locale,
+ 'metadata' => array(
+ 'simpay_form_id' => $form->id,
+ ),
+ 'payment_method_types' => array(
+ 'card',
+ ),
+ 'mode' => 'payment',
+ );
+
+ // Collect Billing Address.
+ if ( true === $form->enable_billing_address ) {
+ $session_args['billing_address_collection'] = 'required';
+ } else {
+ $session_args['billing_address_collection'] = 'auto';
+ }
+
+ // Collect Shipping Address.
+ if ( true === $form->enable_shipping_address ) {
+ $session_args['shipping_address_collection'] = array(
+ 'allowed_countries' => i18n\get_available_shipping_address_countries(),
+ );
+ }
+
+ // Success URL.
+ $session_args['success_url'] = add_query_arg(
+ 'session_id',
+ '{CHECKOUT_SESSION_ID}',
+ PaymentRequestUtils::get_return_url( $request )
+ );
+
+ // Cancel URL.
+ $session_args['cancel_url'] = PaymentRequestUtils::get_cancel_url( $request );
+
+ // Submit type.
+ if ( ! empty( $form->checkout_submit_type ) ) {
+ $session_args['submit_type'] = $form->checkout_submit_type;
+ }
+
+ // Phone number.
+ $enable_phone = 'yes' === simpay_get_saved_meta(
+ $form->id,
+ '_enable_phone',
+ 'no'
+ );
+
+ if ( true === $enable_phone ) {
+ $session_args['phone_number_collection'] = array(
+ 'enabled' => true,
+ );
+ }
+
+ // Line item.
+ $enable_quantity = 'yes' === simpay_get_saved_meta(
+ $form->id,
+ '_enable_quantity',
+ 'no'
+ );
+
+ $item = array(
+ 'price' => $price->id,
+ 'quantity' => $quantity,
+ 'adjustable_quantity' => array(
+ 'enabled' => $enable_quantity,
+ 'minimum' => $enable_quantity ? 1 : null,
+ ),
+ );
+
+ $session_args['line_items'] = array( $item );
+
+ // Build additional data used to create the underlying Payment Intent.
+ $payment_intent_data = PaymentRequestUtils::get_payment_intent_data(
+ $request
+ );
+
+ // ... add an application fee, if needed.
+ if ( $this->application_fee->has_application_fee() ) {
+ $payment_intent_data['application_fee_amount'] =
+ $this->application_fee->get_application_fee_amount(
+ $price->unit_amount
+ );
+ }
+
+ $session_args['payment_intent_data'] = $payment_intent_data;
+
+ return $session_args;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Traits/CheckoutSessionTrait.php b/src/RestApi/Internal/Payment/Traits/CheckoutSessionTrait.php
new file mode 100644
index 00000000..2f78abb9
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Traits/CheckoutSessionTrait.php
@@ -0,0 +1,110 @@
+ $session_args Checkout Session arguments.
+ * @return \SimplePay\Vendor\Stripe\Checkout\Session
+ */
+ private function create_checkout_session( $request, $session_args ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $form_values = PaymentRequestUtils::get_form_values( $request );
+
+ /** @var string|null $customer_id */
+ $customer_id = isset( $session_args['customer'] )
+ ? $session_args['customer']
+ : null;
+
+ /**
+ * Filters arguments used to create a Checkout Session from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param array $session_args Checkout Session arguments.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Deprecated.
+ * @param array $form_values Form values.
+ * @param string|null $customer_id Customer ID, if being used.
+ */
+ $session_args = apply_filters(
+ 'simpay_get_session_args_from_payment_form_request',
+ $session_args,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ /**
+ * Allows processing before a Checkout\Session is created from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param array $session_args Checkout Session arguments.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Deprecated.
+ * @param array $form_values Form values.
+ * @param string|null $customer_id Customer ID, if being used.
+ */
+ do_action(
+ 'simpay_before_checkout_session_from_payment_form_request',
+ $session_args,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ $session = API\CheckoutSessions\create(
+ $session_args,
+ $form->get_api_request_args()
+ );
+
+ /**
+ * Allows further processing after a Checkout\Session is created from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param \SimplePay\Vendor\Stripe\Checkout\Session $session Checkout Session.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Deprecated.
+ * @param array $form_values Form values.
+ * @param string|null $customer_id Customer ID, if being used.
+ */
+ do_action(
+ 'simpay_after_checkout_session_from_payment_form_request',
+ $session,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ return $session;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Traits/CustomerTrait.php b/src/RestApi/Internal/Payment/Traits/CustomerTrait.php
new file mode 100644
index 00000000..b30a0c00
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Traits/CustomerTrait.php
@@ -0,0 +1,274 @@
+get_display_type() ) {
+ return true;
+ }
+
+ /** @var array> $custom_fields */
+ $custom_fields = simpay_get_saved_meta(
+ PaymentRequestUtils::get_form( $request )->id,
+ '_custom_fields',
+ array()
+ );
+
+ return (
+ array_key_exists( 'customer_name', $custom_fields ) ||
+ array_key_exists( 'email', $custom_fields ) ||
+ array_key_exists( 'telephone', $custom_fields ) ||
+ array_key_exists( 'address', $custom_fields ) ||
+ array_key_exists( 'coupon', $custom_fields )
+ );
+ }
+
+ /**
+ * Returns the customer arguments for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return null|\SimplePay\Vendor\Stripe\Customer
+ */
+ private function get_customer( $request ) {
+ if ( false === $this->is_using_customer( $request ) ) {
+ return null;
+ }
+
+ // @todo in the future we may allow using an existing customer.
+ return $this->create_customer( $request );
+ }
+
+ /**
+ * Creates a Customer for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return \SimplePay\Vendor\Stripe\Customer
+ */
+ private function create_customer( $request ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $form_values = PaymentRequestUtils::get_form_values( $request );
+ $customer_args = $this->get_customer_args( $request );
+
+ /**
+ * Filters arguments used to create a Customer from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param array $customer_args Customer arguments.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $arg2 Deprecated.
+ * @param array $form_values Form values.
+ * @return array
+ */
+ $customer_args = apply_filters(
+ 'simpay_get_customer_args_from_payment_form_request',
+ $customer_args,
+ $form,
+ array(),
+ $form_values
+ );
+
+ /**
+ * Allow further processing before a Customer is created from a posted form.
+ *
+ * @since 3.6.0
+ *
+ * @param array $customer_args Customer arguments.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $arg2 Deprecated.
+ * @param array $form_values Form values.
+ */
+ do_action(
+ 'simpay_before_customer_from_payment_form_request',
+ $customer_args,
+ $form,
+ array(),
+ $form_values
+ );
+
+ $customer = API\Customers\create(
+ $customer_args,
+ $form->get_api_request_args()
+ );
+
+ /**
+ * Allow further processing after a Customer is created from a posted form.
+ *
+ * @since 3.6.0
+ *
+ * @param \SimplePay\Vendor\Stripe\Customer $customer Customer.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Deprecated.
+ * @param array $form_values Form values.
+ */
+ do_action(
+ 'simpay_after_customer_from_payment_form_request',
+ $customer,
+ $form,
+ array(),
+ $form_values
+ );
+
+ return $customer;
+ }
+
+ /**
+ * Returns arguments for creating a Customer for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array
+ * @throws \Exception If the tax ID is not valid.
+ */
+ private function get_customer_args( $request ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $form_values = PaymentRequestUtils::get_form_values( $request );
+
+ $customer_args = array(
+ 'name' => null,
+ 'phone' => null,
+ 'email' => null,
+ 'metadata' => array(
+ 'simpay_form_id' => $form->id,
+ ),
+ 'tax' => array(
+ 'ip_address' => Utils\get_current_ip_address(),
+ ),
+ );
+
+ // Attach coupon to metadata.
+ if ( ! empty( $request->get_param( 'coupon_code' ) ) ) {
+ $customer_args['coupon'] = $request->get_param( 'coupon_code' );
+
+ // Clear Stripe object cache so dynamic values are available.
+ // @todo implement cache clearing within Stripe_Object_Query_Trait
+ // when it is available in this namespace.
+ delete_transient( 'simpay_stripe_' . $customer_args['coupon'] );
+ }
+
+ // Attach email.
+ if ( isset( $form_values['simpay_email'] ) ) {
+ /** @var string $email */
+ $email = $form_values['simpay_email'];
+ $customer_args['email'] = sanitize_text_field( $email );
+ }
+
+ // Attach name.
+ if ( isset( $form_values['simpay_customer_name'] ) ) {
+ /** @var string $name */
+ $name = $form_values['simpay_customer_name'];
+ $customer_args['name'] = sanitize_text_field( $name );
+ }
+
+ // Attach phone number.
+ if ( isset( $form_values['simpay_telephone'] ) ) {
+ /** @var string $phone */
+ $phone = $form_values['simpay_telephone'];
+ $customer_args['phone'] = sanitize_text_field( $phone );
+ }
+
+ // Attach a Tax ID.
+ if ( isset( $form_values['simpay_tax_id'] ) ) {
+ /** @var string $tax_id_type */
+ $tax_id_type = isset( $form_values['simpay_tax_id_type'] )
+ ? $form_values['simpay_tax_id_type']
+ : '';
+
+ $valid_tax_id_types = i18n\get_stripe_tax_id_types();
+
+ if ( false === array_key_exists( $tax_id_type, $valid_tax_id_types ) ) {
+ throw new Exception(
+ esc_html__( 'Please select a valid Tax ID type.', 'stripe' )
+ );
+ }
+
+ /** @var string $tax_id */
+ $tax_id = $form_values['simpay_tax_id'];
+ $tax_id = sanitize_text_field( $tax_id );
+
+ $customer_args['tax_id_data'] = array(
+ array(
+ 'type' => $tax_id_type,
+ 'value' => $tax_id,
+ ),
+ );
+ }
+
+ // Attach billing address.
+ /** @var array> */
+ $billing_address = $request->get_param( 'billing_address' );
+
+ if ( $billing_address ) {
+ $customer_args['address'] = isset( $billing_address['address'] )
+ ? $billing_address['address']
+ : null;
+
+ if ( isset( $billing_address['name'] ) && ! isset( $customer_args['name'] ) ) {
+ $customer_args['name'] = $billing_address['name'];
+ }
+ }
+
+ // Attach shipping address.
+ /** @var array> */
+ $shipping_address = $request->get_param( 'shipping_address' );
+
+ if ( $shipping_address ) {
+ $customer_args['shipping'] = $shipping_address;
+
+ // Set a phone number if available.
+ $customer_args['shipping']['phone'] = isset( $customer_args['phone'] )
+ ? $customer_args['phone']
+ : null;
+ }
+
+ // Remove null values, Stripe doesn't like them.
+ // Do this before Shipping, because we need a value for Shipping Name.
+ $customer_args = array_filter(
+ $customer_args,
+ function( $var ) {
+ return ! is_null( $var );
+ }
+ );
+
+ return $customer_args;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Traits/PaymentIntentTrait.php b/src/RestApi/Internal/Payment/Traits/PaymentIntentTrait.php
new file mode 100644
index 00000000..b364e058
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Traits/PaymentIntentTrait.php
@@ -0,0 +1,190 @@
+id;
+
+ // Start with base arguments that are common to all payment intents,
+ // regardless of what generates them (Subscription, Checkout Session, Order, etc).
+ $payment_intent_args = array_merge(
+ array(
+ 'metadata' => PaymentRequestUtils::get_payment_metadata( $request ),
+ 'expand' => array(
+ 'customer',
+ ),
+ ),
+ PaymentRequestUtils::get_payment_intent_data( $request )
+ );
+
+ // Set the customer.
+ $payment_intent_args['customer'] = $customer_id;
+
+ // Calculate the base amount, which is the unit amount multiplied by the quantity.
+ $unit_amount = PaymentRequestUtils::get_amount( $request );
+
+ // Add the application fee, if needed.
+ if ( $this->application_fee->has_application_fee() ) {
+ $application_fee = $this->application_fee->get_application_fee_amount(
+ $unit_amount
+ );
+
+ $payment_intent_args['application_fee_amount'] = $application_fee;
+ }
+
+ $payment_intent_args['amount'] = $unit_amount;
+ $payment_intent_args['currency'] = $price->currency;
+
+ // Add the allowed payment method types.
+ $payment_intent_args['payment_method_types'] = PaymentRequestUtils::get_payment_method_types(
+ $request
+ );
+
+ // Add the payment method options.
+ $payment_intent_args['payment_method_options'] = PaymentRequestUtils::get_payment_method_options(
+ $request
+ );
+
+ /**
+ * Filters arguments used to create a PaymentIntent from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param array $payment_intent_args PaymentIntent arguments.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $arg2 Deprecated.
+ * @param array $form_values Form values.
+ * @param string $customer Customer ID.
+ * @return array
+ */
+ $payment_intent_args = apply_filters(
+ 'simpay_get_paymentintent_args_from_payment_form_request',
+ $payment_intent_args,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ /**
+ * Allows processing before a PaymentIntent is created from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param array $payment_intent_args Arguments used to create a PaymentIntent.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Form data generated by the client.
+ * @param array $form_values Values of named fields in the payment form.
+ * @param string $customer_id Stripe Customer ID.
+ */
+ do_action(
+ 'simpay_before_paymentintent_from_payment_form_request',
+ $payment_intent_args,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ // If we are using automatic tax calculations, verify we have a tax
+ // calculation we can associate with this payment before creating.
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+ $tax_calc_id = PaymentRequestUtils::get_tax_calc_id( $request );
+
+ if ( 'automatic' === $tax_status && empty( $tax_calc_id ) ) {
+ throw new Exception(
+ __( 'Invalid request. Please try again.', 'stripe' )
+ );
+ }
+
+ $payment_intent = API\PaymentIntents\create(
+ $payment_intent_args,
+ $form->get_api_request_args()
+ );
+
+ // ... and now associate the tax calculation with the payment via a transaction.
+ // @link https://stripe.com/docs/api/tax/transactions/create
+ if ( 'automatic' === $tax_status ) {
+ Stripe_API::request(
+ 'Tax\Transaction',
+ 'create',
+ array(
+ 'from_calculation' => $tax_calc_id,
+ 'reference' => $payment_intent->id,
+ ),
+ $form->get_api_request_args()
+ );
+ }
+
+ /**
+ * Allows further processing after a PaymentIntent is created from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param \SimplePay\Vendor\Stripe\PaymentIntent $paymentintent Stripe PaymentIntent.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Form data generated by the client.
+ * @param array $form_values Values of named fields in the payment form.
+ * @param string $customer_id Stripe Customer ID.
+ */
+ do_action(
+ 'simpay_after_paymentintent_from_payment_form_request',
+ $payment_intent,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ return $payment_intent;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Traits/SubscriptionTrait.php b/src/RestApi/Internal/Payment/Traits/SubscriptionTrait.php
new file mode 100644
index 00000000..48fa3d13
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Traits/SubscriptionTrait.php
@@ -0,0 +1,471 @@
+id;
+ $form = PaymentRequestUtils::get_form( $request );
+ $form_values = PaymentRequestUtils::get_form_values( $request );
+
+ $subscription_args = $this->get_subscription_args( $request );
+ $subscription_args['payment_behavior'] = 'default_incomplete';
+ $subscription_args['customer'] = $customer_id;
+ $subscription_args['items'] = $this->get_subscription_recurring_line_items( $request );
+ $subscription_args['add_invoice_items'] = $this->get_subscription_additional_invoice_line_items( $request );
+ $subscription_args['off_session'] = true;
+ $subscription_args['payment_settings'] = array(
+ 'payment_method_types' => PaymentRequestUtils::get_payment_method_types( $request ),
+ 'payment_method_options' => PaymentRequestUtils::get_payment_method_options( $request ),
+ 'save_default_payment_method' => 'on_subscription',
+ );
+ $subscription_args['expand'] = array(
+ 'latest_invoice.payment_intent',
+ 'customer',
+ 'pending_setup_intent',
+ );
+
+ // Add the fee recovery line items, if needed.
+ // Instead of running this in `self::get_subscription_recurring_line_items()`
+ // and `self::get_subscription_additional_invoice_line_items()`, we run it here
+ // so we have access to all of the line items at once.
+ $is_covering_fees = PaymentRequestUtils::is_covering_fees( $request );
+
+ if (
+ $form->has_fee_recovery() &&
+ ( $form->has_forced_fee_recovery() || $is_covering_fees )
+ ) {
+ $subscription_args = FeeRecoveryUtils::add_subscription_fee_recovery_line_items(
+ $request,
+ $subscription_args
+ );
+ }
+
+ // Add tax rates to line items, if needed.
+
+ /** @var array $items */
+ $items = $subscription_args['items'];
+
+ $subscription_args['items'] = TaxUtils::add_tax_rates_to_line_items(
+ $request,
+ $items
+ );
+
+ /** @var array $add_invoice_items */
+ $add_invoice_items = $subscription_args['add_invoice_items'];
+
+ $subscription_args['add_invoice_items'] = TaxUtils::add_tax_rates_to_line_items(
+ $request,
+ $add_invoice_items
+ );
+
+ // Add automatic tax collection, if needed.
+ $subscription_args = TaxUtils::add_automatic_tax_args(
+ $request,
+ $subscription_args
+ );
+
+ // Add the application fee, if needed.
+ if ( $this->application_fee->has_application_fee() ) {
+ $subscription_args['application_fee_percent'] =
+ $this->application_fee->get_application_fee_percentage();
+ }
+
+ /**
+ * Filters arguments used to generate a Subscription from a payment form request.
+ *
+ * @since 3.6.0
+ *
+ * @param array $subscription_args Subscription arguments.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $arg2 Deprecated.
+ * @param array $form_values Form values.
+ * @param string $customer Customer ID.
+ * @return array
+ */
+ $subscription_args = apply_filters(
+ 'simpay_get_subscription_args_from_payment_form_request',
+ $subscription_args,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ /**
+ * Allow further processing before a Subscription is created from a posted form.
+ *
+ * @since 3.6.0
+ *
+ * @param array $subscription_args Subscription arguments.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $arg2 Deprecated.
+ * @param array $form_values Form values.
+ * @param string $customer Customer ID.
+ */
+ do_action(
+ 'simpay_before_subscription_from_payment_form_request',
+ $subscription_args,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ $subscription = API\Subscriptions\create(
+ $subscription_args,
+ $form->get_api_request_args()
+ );
+
+ /**
+ * Allow further processing after a Subscription is created from a posted form.
+ *
+ * @since 3.6.0
+ *
+ * @param \SimplePay\Vendor\Stripe\Subscription $subscription Subscription..
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Deprecated.
+ * @param array $form_values Form values.
+ * @param string $customer Customer ID.
+ */
+ do_action(
+ 'simpay_after_subscription_from_payment_form_request',
+ $subscription,
+ $form,
+ array(),
+ $form_values,
+ $customer_id
+ );
+
+ return $subscription;
+ }
+
+ /**
+ * Returns data for a Subscription for the given request.
+ *
+ * This is generic data that applies to a base PaymentIntent, regardless
+ * of what creates it (Checkout Session, etc). Additional arguments used
+ * just for Stripe Billing are added in `SubscriptionTrait::create_subscription()`.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array>
+ */
+ private function get_subscription_args( $request ) {
+ $price = PaymentRequestUtils::get_price( $request );
+ $subscription_data = array();
+
+ // Set the trial period, if needed.
+ if ( $price->recurring && isset( $price->recurring['trial_period_days'] ) ) {
+ $subscription_data['trial_period_days'] = $price->recurring['trial_period_days'];
+ }
+
+ // Set the metadata with a combination of the standard payment metadata and
+ // additional subscription metadata.
+ $subscription_data['metadata'] = array_merge(
+ PaymentRequestUtils::get_payment_metadata( $request ),
+ array(
+ 'simpay_subscription_key' => $this->get_subscription_key(),
+ )
+ );
+
+ // Add invoice limit metadata, if needed.
+ $max_charges = isset( $price->recurring['invoice_limit'] )
+ ? $price->recurring['invoice_limit']
+ : 0;
+
+ if ( 0 !== $max_charges ) {
+ $charge_count = isset( $price->recurring['trial_period_days'] ) ? -1 : 0;
+
+ $subscription_data['metadata']['simpay_charge_max'] = $max_charges;
+ $subscription_data['metadata']['simpay_charge_count'] = $charge_count;
+ }
+
+ return $subscription_data;
+ }
+
+ /**
+ * Returns recurring line items for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array>
+ */
+ private function get_subscription_recurring_line_items( $request ) {
+ $line_items = array();
+ $form = PaymentRequestUtils::get_form( $request );
+ $price = PaymentRequestUtils::get_price( $request );
+ $quantity = PaymentRequestUtils::get_quantity( $request );
+ $custom_amount = PaymentRequestUtils::get_custom_unit_amount( $request );
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+ $tax_behavior = get_post_meta( $form->id, '_tax_behavior', true );
+
+ // Add the base line item.
+ $base_item = array(
+ 'quantity' => $quantity,
+ );
+
+ $custom_price_data = array(
+ 'unit_amount' => $custom_amount,
+ 'currency' => $price->currency,
+ 'recurring' => array(
+ 'interval' => $price->recurring['interval'],
+ 'interval_count' => $price->recurring['interval_count'],
+ ),
+ 'product' => $price->product_id,
+ 'tax_behavior' => 'automatic' === $tax_status
+ ? $tax_behavior
+ : 'unspecified',
+ );
+
+ // Set the base line item price when optionally recurring.
+ if ( true === PaymentRequestUtils::is_optionally_recurring( $request ) ) {
+ // Optional recurring option is a defined price.
+ if (
+ isset( $price->recurring['id'] ) &&
+ true === simpay_payment_form_prices_is_defined_price(
+ $price->recurring['id']
+ )
+ ) {
+ $base_item['price'] = $price->recurring['id'];
+
+ // Optional recurring option is a custom amount.
+ } else {
+ $base_item['price_data'] = $custom_price_data;
+ }
+
+ // Always recurring custom amount.
+ } elseif ( false === simpay_payment_form_prices_is_defined_price( $price->id ) ) {
+ $base_item['price_data'] = $custom_price_data;
+
+ // Always recurring defined price.
+ } else {
+ $base_item['price'] = $price->id;
+ }
+
+ // If this subscription is being created for Stripe Checkout, then check
+ // if quantity adjustment is allowed.
+ if ( 'stripe_checkout' === $form->get_display_type() ) {
+ $enable_quantity = 'yes' === simpay_get_saved_meta(
+ $form->id,
+ '_enable_quantity',
+ 'no'
+ );
+
+ if ( $enable_quantity ) {
+ $base_item['adjustable_quantity'] = array(
+ 'enabled' => true,
+ 'minimum' => 1,
+ );
+ }
+ }
+
+ $line_items[] = $base_item;
+
+ // Set the line item tax behavior, if needed.
+
+ return $line_items;
+ }
+
+ /**
+ * Returns one-time line items (first invoice only) for the given request.
+ *
+ * Currently this is used for a recurring price option's setup fee(s).
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array>
+ */
+ private function get_subscription_additional_invoice_line_items( $request ) {
+ $line_items = array();
+
+ // Add a line item for the legacy per-plan fee, if needed.
+ $plan_fee = $this->get_subscription_additional_invoice_line_item(
+ $request,
+ 'plan'
+ );
+
+ if ( ! empty( $plan_fee ) ) {
+ $line_items[] = $plan_fee;
+ }
+
+ // Add a line item for the initial setup fee, if needed.
+ $setup_fee = $this->get_subscription_additional_invoice_line_item(
+ $request,
+ 'setup'
+ );
+
+ if ( ! empty( $setup_fee ) ) {
+ $line_items[] = $setup_fee;
+ }
+
+ return $line_items;
+ }
+
+ /**
+ * Returns a one-time line item (first invoice only) for the given request and type.
+ *
+ * This is a helper method to make it easier to create a legacy "plan fee"
+ * alongside the still-supported "setup fee".
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @param string $type The type of line item to return. Either "plan" or "setup".
+ * @return array
+ */
+ private function get_subscription_additional_invoice_line_item( $request, $type ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $price = PaymentRequestUtils::get_price( $request );
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+ $tax_behavior = get_post_meta( $form->id, '_tax_behavior', true );
+ $line_item = array();
+
+ // Fetch price option line items.
+ $price_line_items = ! empty( $price->line_items )
+ ? $price->line_items
+ : array();
+
+ if ( empty( $price_line_items ) ) {
+ return $line_item;
+ }
+
+ // Find the line item for the given type.
+ $line_item_index = 'plan' === $type ? 1 : 0;
+ $price_line_item = isset( $price_line_items[ $line_item_index ] )
+ ? $price_line_items[ $line_item_index ]
+ : array();
+
+ if ( empty( $price_line_item ) ) {
+ return $line_item;
+ }
+
+ $unit_amount = $price_line_item['unit_amount'];
+ $currency = $price->currency;
+
+ if ( 0 === $unit_amount ) {
+ return $line_item;
+ }
+
+ $line_item_args = array(
+ 'quantity' => 1,
+ 'price_data' => array(
+ 'unit_amount' => $unit_amount,
+ 'currency' => $currency,
+ 'tax_behavior' => 'automatic' === $tax_status
+ ? $tax_behavior
+ : 'unspecified',
+ ),
+ );
+
+ // Use a dynamically created Product with Stripe Checkout for better
+ // line item naming since it is displayed on the Stripe Checkout page.
+ if ( 'stripe_checkout' === $form->get_display_type() ) {
+ $line_item_args['price_data']['product_data'] = array(
+ 'name' => 'plan' === $type
+ ? __( 'Plan Setup Fee', 'stripe' )
+ : __( 'Initial Setup Fee', 'stripe' ),
+ );
+
+ // Set the dynamic parent product's tax information, if needed.
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+ $tax_code = get_post_meta( $form->id, '_tax_code', true );
+ $tax_behavior = get_post_meta( $form->id, '_tax_behavior', true );
+
+ if ( 'automatic' === $tax_status ) {
+ $line_item_args['price_data']['tax_behavior'] = $tax_behavior;
+ $line_item_args['price_data']['product_data']['tax_code'] = $tax_code;
+ }
+
+ // Otherwise set an existing Product.
+ } else {
+ $line_item_args['price_data']['product'] = $price->product_id;
+ }
+
+ $filter_name = 'plan' === $type
+ ? 'simpay_get_plan_setup_fee_args_from_payment_form_request'
+ : 'simpay_get_setup_fee_args_from_payment_form_request';
+
+ /**
+ * Filters the arguments used to create the additional line item.
+ *
+ * @since 3.6.0
+ *
+ * @param array $plan_fee_args Arguments used to create the InvoiceItem.
+ * @param \SimplePay\Core\Abstracts\Form $form Form instance.
+ * @param array $form_data Form data generated by the client.
+ * @param array $form_values Values of named fields in the payment form.
+ * @param string $customer_id Stripe Customer ID.
+ */
+ $line_item_args = apply_filters(
+ $filter_name,
+ $line_item_args,
+ $form,
+ array(),
+ PaymentRequestUtils::get_form_values( $request ),
+ ''
+ );
+
+ return $line_item_args;
+ }
+
+ /**
+ * Returns a unique subscription key.
+ *
+ * @since 4.7.0
+ *
+ * @return string
+ */
+ private function get_subscription_key() {
+ $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
+ $hash = date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpsp', true ); // @phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
+ $subscription_key = strtolower( md5( $hash ) );
+
+ return $subscription_key;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/CouponUtils.php b/src/RestApi/Internal/Payment/Utils/CouponUtils.php
new file mode 100644
index 00000000..dc154824
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/CouponUtils.php
@@ -0,0 +1,214 @@
+ The coupon data.
+ */
+ public static function get_coupon_data( $request, $coupon_code, $amount, $currency ) {
+ $form = PaymentRequestUtils::get_form( $request );
+
+ // Look at internal records first to force a sync between modes.
+ $api_args = $form->get_api_request_args();
+ $coupons = new Coupon_Query(
+ $form->is_livemode(),
+ $api_args['api_key']
+ );
+
+ $coupon = $coupons->get_by_name( $coupon_code );
+
+ // Fall back to a direct Stripe check.
+ if ( ! $coupon instanceof Coupon ) {
+ try {
+ $coupon = API\Coupons\retrieve( $coupon_code, $api_args );
+ } catch ( Exception $e ) {
+ return array(
+ 'error' => esc_html__(
+ 'Sorry, this coupon not valid.',
+ 'stripe'
+ ),
+ );
+ }
+ } else {
+ // We can only check for restrictions on an internally tracked coupon.
+ if ( false === $coupon->applies_to_form( $form->id ) ) {
+ return array(
+ 'error' => esc_html__(
+ 'Sorry, this coupon not valid.',
+ 'stripe'
+ ),
+ );
+ }
+
+ // Use just the Stripe object of the internal record for the remaining
+ // checks to match preexisting direct API usage.
+ $coupon = $coupon->object;
+ }
+
+ /** @var \SimplePay\Vendor\Stripe\Coupon $coupon */
+
+ // Invalid coupon.
+ if ( ! simpay_is_coupon_valid( $coupon ) ) {
+ return array(
+ 'error' => esc_html__(
+ 'Sorry, this coupon not valid.',
+ 'stripe'
+ ),
+ );
+ }
+
+ // Determines the discounted amount if percentage-based.
+ if ( ! empty( $coupon->percent_off ) ) {
+
+ // We do not support 100% off coupons.
+ if ( (float) 100 === $coupon->percent_off ) {
+ return array(
+ 'error' => esc_html__(
+ 'Sorry, this coupon amount (100%) is not valid.',
+ 'stripe'
+ ),
+ );
+ }
+
+ $discount_percent = ( 100 - $coupon->percent_off ) / 100;
+ $discount = (
+ $amount - round( $amount * $discount_percent )
+ );
+ $discount_formatted = "$coupon->percent_off%";
+
+ // Determines the discounted amount if fixed.
+ } elseif ( ! empty( $coupon->amount_off ) ) {
+ if ( $coupon->currency !== $currency ) {
+ return array(
+ 'error' => esc_html__(
+ 'Sorry, this coupon not valid for the selected currency.',
+ 'stripe'
+ ),
+ );
+ }
+
+ $discount = $coupon->amount_off;
+ $discount_formatted = simpay_format_currency(
+ $discount,
+ $currency
+ );
+ } else {
+ return array(
+ 'error' => esc_html__(
+ 'Invalid request. Please try again.',
+ 'stripe'
+ ),
+ );
+ }
+
+ $min = simpay_convert_amount_to_cents(
+ simpay_global_minimum_amount()
+ );
+
+ // Check if the coupon puts the total below the minimum amount.
+ if ( ( $amount - $discount ) < $min ) {
+ return array(
+ 'error' => esc_html__(
+ 'Sorry, this coupon puts the total below the required minimum amount.',
+ 'stripe'
+ ),
+ );
+ }
+
+ return array(
+ 'coupon' => $coupon,
+ 'message' => sprintf(
+ /* translators: %1$s Coupon code. %2$s discount amount. */
+ __( '%1$s: %2$s off', 'stripe' ),
+ $coupon->id,
+ $discount_formatted
+ ),
+ );
+
+ }
+
+ /**
+ * Returns the discount amount for the given request, amount, and customer.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @param int $amount_to_discount The amount to calculate the discount amount for.
+ * @param string|null $customer_id The Stripe Customer ID. If not supplied the discount amount
+ * will not be validated against the customer.
+ * @return int
+ */
+ public static function get_discount_unit_amount( $request, $amount_to_discount, $customer_id = null ) {
+ $coupon = PaymentRequestUtils::get_coupon_code( $request );
+ $form = PaymentRequestUtils::get_form( $request );
+
+ if ( ! $coupon ) {
+ return 0;
+ }
+
+ // If we have a customer available, retrieve the coupon from the customer.
+ if ( $customer_id ) {
+ $customer = API\Customers\retrieve(
+ $customer_id,
+ $form->get_api_request_args()
+ );
+
+ $coupon = isset( $customer->discount )
+ ? $customer->discount->coupon
+ : false;
+
+ if ( false === $coupon ) {
+ return 0;
+ }
+
+ // Otherwise retrieve the coupon directly.
+ } else {
+ $coupon = API\Coupons\retrieve(
+ $coupon,
+ $form->get_api_request_args()
+ );
+ }
+
+ if ( $coupon->amount_off ) {
+ $unit_amount = $coupon->amount_off;
+ } else {
+ $percent_off = $coupon->percent_off / 100;
+ $unit_amount = $amount_to_discount * $percent_off;
+ }
+
+ return (int) round( $unit_amount );
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/FeeRecoveryUtils.php b/src/RestApi/Internal/Payment/Utils/FeeRecoveryUtils.php
new file mode 100644
index 00000000..a7c23efd
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/FeeRecoveryUtils.php
@@ -0,0 +1,157 @@
+ $subscription_args The subscription arguments.
+ * @return array
+ */
+ public static function add_subscription_fee_recovery_line_items( $request, $subscription_args ) {
+ $price = PaymentRequestUtils::get_price( $request );
+
+ /** @var array>> $invoice_items */
+ $invoice_items = $subscription_args['add_invoice_items'];
+
+ $one_time_line_items_total = array_reduce(
+ $invoice_items,
+ function( $total, $item ) {
+ /** @var array> $item */
+ /** @var array $price_data */
+ $price_data = $item['price_data'];
+
+ return $total + $price_data['unit_amount'];
+ },
+ 0
+ );
+
+ $is_trial = (
+ $price->recurring &&
+ isset( $price->recurring['trial_period_days'] )
+ );
+
+ $recurring_line_items_total = ! $is_trial
+ ? PaymentRequestUtils::get_unit_amount( $request )
+ : 0;
+
+ $total_due_today = (
+ $one_time_line_items_total + $recurring_line_items_total
+ );
+
+ $fee_recovery_today = self::get_fee_recovery_unit_amount(
+ $request,
+ $total_due_today
+ );
+ $fee_recovery_recurring = self::get_fee_recovery_unit_amount(
+ $request,
+ PaymentRequestUtils::get_unit_amount( $request )
+ );
+
+ $one_time_fee_recovery_line_item = array(
+ 'quantity' => 1,
+ 'price_data' => array(
+ 'unit_amount' => $is_trial
+ ? $fee_recovery_today
+ : $fee_recovery_today - $fee_recovery_recurring,
+ 'currency' => $price->currency,
+ 'product' => $price->product_id,
+ ),
+ );
+
+ $recurring_fee_recovery_line_item = array(
+ 'quantity' => 1,
+ 'price_data' => array(
+ 'unit_amount' => $fee_recovery_recurring,
+ 'currency' => $price->currency,
+ 'product' => $price->product_id,
+ 'recurring' => array(
+ 'interval' => $price->recurring['interval'],
+ 'interval_count' => $price->recurring['interval_count'],
+ ),
+ ),
+ );
+
+ $subscription_args['items'][] = $recurring_fee_recovery_line_item; // @phpstan-ignore-line
+
+ if ( 0 !== $total_due_today ) {
+ $subscription_args['add_invoice_items'][] = $one_time_fee_recovery_line_item; // @phpstan-ignore-line
+ }
+
+ // Attach the amount as metadata so we can access it later. This is
+ // probably not the most obvious spot, but currently it provides
+ // the most flexibility for updating the payment amount when a failure occurs.
+ $subscription_args['metadata']['simpay_fee_recovery_unit_amount'] = $fee_recovery_recurring; // @phpstan-ignore-line
+
+ return $subscription_args;
+ }
+
+ /**
+ * Returns the Fee Recovery amount for the given request, and amount.
+ *
+ * The payment method type must be available in the request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @param int $amount_to_recover_for The amount to calculate the Fee Recovery amount for.
+ * @return int
+ */
+ public static function get_fee_recovery_unit_amount( $request, $amount_to_recover_for ) {
+ $is_covering_fees = $request->get_param( 'is_covering_fees' );
+ $form = PaymentRequestUtils::get_form( $request );
+
+ if ( ! $form->has_forced_fee_recovery() && ! $is_covering_fees ) {
+ return 0;
+ }
+
+ $payment_method_settings = Payment_Methods\get_form_payment_method_settings(
+ $form,
+ PaymentRequestUtils::get_payment_method_type( $request )
+ );
+
+ if (
+ ! isset(
+ $payment_method_settings['fee_recovery'],
+ $payment_method_settings['fee_recovery']['enabled']
+ ) ||
+ 'yes' !== $payment_method_settings['fee_recovery']['enabled']
+ ) {
+ return 0;
+ }
+
+ $percent = $payment_method_settings['fee_recovery']['percent'];
+ $fixed = $payment_method_settings['fee_recovery']['amount'];
+
+ return (int) round(
+ ( $amount_to_recover_for + $fixed )
+ /
+ ( 1 - ( $percent / 100 ) )
+ -
+ $amount_to_recover_for
+ );
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/PaymentRequestUtils.php b/src/RestApi/Internal/Payment/Utils/PaymentRequestUtils.php
new file mode 100644
index 00000000..d54a1ce4
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/PaymentRequestUtils.php
@@ -0,0 +1,669 @@
+get_param( 'form_id' );
+
+ /** @var \SimplePay\Core\Abstracts\Form $form This has already been validated by the schema. IDE helper. */
+ $form = simpay_get_form( $form_id );
+
+ return $form;
+ }
+
+ /**
+ * Returns the form values for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array>
+ */
+ public static function get_form_values( $request ) {
+ /** @var array> $form_values */
+ $form_values = $request->get_param( 'form_values' );
+
+ return $form_values;
+ }
+
+ /**
+ * Returns the `PriceOption` for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return \SimplePay\Core\PaymentForm\PriceOption
+ */
+ public static function get_price( $request ) {
+ /** @var string $price_id This has already been validated by the schema. IDE helper. */
+ $price_id = $request->get_param( 'price_id' );
+
+ /** @var \SimplePay\Core\PaymentForm\PriceOption $price This has already been validated by the schema. IDE helper. */
+ $price = simpay_payment_form_prices_get_price_by_id(
+ self::get_form( $request ),
+ $price_id
+ );
+
+ return $price;
+ }
+
+ /**
+ * Returns the currency for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return string
+ */
+ public static function get_currency( $request ) {
+ return self::get_price( $request )->currency;
+ }
+
+ /**
+ * Returns the purchase quantity for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return int
+ */
+ public static function get_quantity( $request ) {
+ /** @var int $quantity This has already been validated by the schema. IDE helper. */
+ $quantity = $request->get_param( 'quantity' );
+
+ return $quantity;
+ }
+
+ /**
+ * Returns the custom amount for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return int
+ */
+ public static function get_custom_unit_amount( $request ) {
+ /** @var int $custom_amount This has already been validated by the schema. IDE helper. */
+ $custom_amount = $request->get_param( 'custom_amount' );
+
+ return $custom_amount;
+ }
+
+ /**
+ * Returns the coupon code for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return string
+ */
+ public static function get_coupon_code( $request ) {
+ /** @var string $coupon_code This has already been validated by the schema. IDE helper. */
+ $coupon_code = $request->get_param( 'coupon_code' );
+
+ return $coupon_code;
+ }
+
+ /**
+ * Returns the tax calculation ID for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return string
+ */
+ public static function get_tax_calc_id( $request ) {
+ /** @var string $tax_calc_id This has already been validated by the schema. IDE helper. */
+ $tax_calc_id = $request->get_param( 'tax_calc_id' );
+
+ return $tax_calc_id;
+ }
+
+ /**
+ * Determines if the payment is opted-in to optionally recurring.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return bool
+ */
+ public static function is_optionally_recurring( $request ) {
+ /** @var bool $is_optionally_recurring This has already been validated by the schema. IDE helper. */
+ $is_optionally_recurring = $request->get_param(
+ 'is_optionally_recurring'
+ );
+
+ return $is_optionally_recurring;
+ }
+
+ /**
+ * Determines if the payment is opted-in to covering processing fees.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return bool
+ */
+ public static function is_covering_fees( $request ) {
+ /** @var bool $is_covering_fees This has already been validated by the schema. IDE helper. */
+ $is_covering_fees = $request->get_param( 'is_covering_fees' );
+
+ return $is_covering_fees;
+ }
+
+ /**
+ * Determines if the payment is recurring.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return bool
+ */
+ public static function is_recurring( $request ) {
+ $price = self::get_price( $request );
+ $is_optionally_recurring = self::is_optionally_recurring( $request );
+
+ return ( $price->can_recur && $is_optionally_recurring ) || $price->recurring;
+ }
+
+ /**
+ * Returns the unit amount for the given request.
+ *
+ * If a custom amount is being used, return that.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return int
+ */
+ public static function get_unit_amount( $request ) {
+ $price = self::get_price( $request );
+ $custom_unit_amount = self::get_custom_unit_amount( $request );
+
+ if ( false === simpay_payment_form_prices_is_defined_price( $price->id ) ) {
+ return $custom_unit_amount;
+ }
+
+ return $price->unit_amount;
+ }
+
+ /**
+ * Returns the total amount for a given request. This accounts for quantity,
+ * discounts, fee recovery, and taxes.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return int
+ */
+ public static function get_amount( $request ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $unit_amount = PaymentRequestUtils::get_unit_amount( $request );
+ $quantity = PaymentRequestUtils::get_quantity( $request );
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+ $tax_behavior = get_post_meta( $form->id, '_tax_behavior', true );
+
+ $unit_amount = $unit_amount * $quantity;
+
+ // Add the fee recovery amount, if needed.
+ if ( $form->has_fee_recovery() ) {
+ $fee_recovery = FeeRecoveryUtils::get_fee_recovery_unit_amount(
+ $request,
+ $unit_amount
+ );
+ $unit_amount = $unit_amount + $fee_recovery;
+ }
+
+ // Remove the coupon amount, if needed.
+ $discount = CouponUtils::get_discount_unit_amount(
+ $request,
+ $unit_amount,
+ null
+ );
+
+ if ( 0 !== $discount ) {
+ $unit_amount = $unit_amount - $discount;
+ }
+
+ // Add the tax amount, if needed.
+ $tax = TaxUtils::get_tax_unit_amount( $request, $unit_amount );
+
+ if ( 0 !== $tax ) {
+ // Automatic tax, and exclusive, so add the amount.
+ if ( 'automatic' === $tax_status && 'exclusive' === $tax_behavior ) {
+ $unit_amount = $unit_amount + $tax;
+
+ // Fixed global, add the amount (accounts for inclusive) in calculatinos.
+ } elseif ( empty( $tax_behavior ) || 'fixed-global' === $tax_behavior ) {
+ $unit_amount = $unit_amount + $tax;
+ }
+ }
+
+ return $unit_amount;
+ }
+
+ /**
+ * Returns data for a PaymentIntent for the given request.
+ *
+ * This is generic data that applies to a base PaymentIntent, regardless
+ * of what creates it (Checkout Session, Subscription, Order, etc).
+ * Additional arguments used just for the PaymentIntent API are added
+ * in `PaymentIntentTrait::create_payment_intent()`.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array|string>
+ */
+ public static function get_payment_intent_data( $request ) {
+ $form = self::get_form( $request );
+ $price = self::get_price( $request );
+ $payment_intent_data = array(
+ 'metadata' => self::get_payment_metadata( $request ),
+ );
+
+ // Set the description.
+ // Use price option label if one is set.
+ if ( null !== $price->label ) {
+ $payment_intent_data['description'] = $price->get_display_label();
+
+ // Fall back to Payment Form title if set.
+ // This is a change in behavior in 4.1, but matches the Stripe Checkout
+ // usage that falls back to the Product title (Payment Form title).
+ } else {
+ if ( ! empty( $form->company_name ) ) {
+ $payment_intent_data['description'] = $form->company_name;
+ }
+ }
+
+ // Set the Statement Descriptor. This is empty by default.
+ if ( ! empty( $form->statement_descriptor ) ) {
+ $payment_intent_data['statement_descriptor'] = $form->statement_descriptor;
+ }
+
+ return $payment_intent_data;
+ }
+
+ /**
+ * Returns metadata for the primary payment object for the given request.
+ *
+ * This is generic data that applies can be applied to the primary payment
+ * object, i.e Checkout Session, Subscription, or PaymentIntent.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array
+ */
+ public static function get_payment_metadata( $request ) {
+ $form = self::get_form( $request );
+ $form_values = self::get_form_values( $request );
+ $price = self::get_price( $request );
+ $unit_amount = self::get_unit_amount( $request );
+ $quantity = self::get_quantity( $request );
+ $subtotal = $unit_amount * $quantity;
+
+ $metadata = array(
+ 'simpay_form_id' => $form->id,
+ 'simpay_unit_amount' => $unit_amount,
+ 'simpay_quantity' => $quantity,
+ 'simpay_price_instances' => sprintf(
+ '%s:%d',
+ $price->instance_id,
+ $quantity
+ ),
+ );
+
+ $license = simpay_get_license();
+
+ // Add additional metadata for non-lite licenses.
+ if ( false === $license->is_lite() ) {
+ // Custom fields.
+ /** @var array $custom_fields Custom fields. */
+ $custom_fields = isset( $form_values['simpay_field'] )
+ ? $form_values['simpay_field']
+ : array();
+
+ foreach ( $custom_fields as $key => $value ) {
+ // Skip empty.
+ if ( '' === trim( $value ) ) {
+ continue;
+ }
+
+ $metadata[ $key ] = $value;
+ }
+
+ $amount = self::get_amount( $request );
+
+ // Fee recovery.
+ $fee_recovery = FeeRecoveryUtils::get_fee_recovery_unit_amount(
+ $request,
+ $subtotal // Safe to use subtotal here because fee recovery does not support taxes or coupons.
+ );
+
+ if ( 0 !== $fee_recovery ) {
+ $metadata['simpay_fee_recovery_unit_amount'] = $fee_recovery;
+ }
+
+ // Tax.
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+ $tax_behavior = get_post_meta( $form->id, '_tax_behavior', true );
+ $tax_unit_amount = TaxUtils::get_tax_unit_amount(
+ $request,
+ $unit_amount
+ );
+
+ switch ( $tax_status ) {
+ case 'automatic':
+ // Find the tax percent based on the total amount, and tax amount.
+ $tax_percent = ( $tax_unit_amount / ( $amount - $tax_unit_amount ) ) * 100;
+ $tax_percent = round( $tax_percent );
+
+ if ( 'exclusive' === $tax_behavior ) {
+ $metadata['simpay_tax_percent_exclusive'] = $tax_percent;
+ $metadata['simpay_tax_unit_amount_exclusive'] = $tax_unit_amount;
+ } else {
+ $metadata['simpay_tax_percent_inclusive'] = $tax_percent;
+ $metadata['simpay_tax_unit_amount_inclusive'] = $tax_unit_amount;
+ }
+
+ break;
+ case 'fixed-global':
+ $metadata['simpay_tax_percent_exclusive'] = simpay_get_payment_form_tax_percentage(
+ $form,
+ 'exclusive'
+ );
+
+ $metadata['simpay_tax_unit_amount_exclusive'] = round( $amount - $subtotal );
+
+ $metadata['simpay_tax_percent_inclusive'] = simpay_get_payment_form_tax_percentage(
+ $form,
+ 'inclusive'
+ );
+
+ $metadata['simpay_tax_unit_amount_inclusive'] = 0;
+
+ if ( 0 !== $metadata['simpay_tax_percent_inclusive'] ) {
+ $metadata['simpay_tax_unit_amount_inclusive'] = round(
+ ( $amount - $subtotal ) - ( $metadata['simpay_tax_percent_inclusive'] / 100 )
+ );
+ }
+
+ break;
+ }
+
+ // Coupon.
+ $coupon_data = CouponUtils::get_coupon_data(
+ $request,
+ self::get_coupon_code( $request ),
+ $unit_amount,
+ self::get_currency( $request )
+ );
+
+ if ( ! isset( $coupon_data['error'] ) ) {
+ /** @var array $coupon_data */
+ $metadata['simpay_coupon_code'] = $coupon_data['coupon']->id;
+ }
+ }
+
+ // Sanitize all keys and values.
+ $_metadata = array();
+
+ foreach ( $metadata as $key => $value ) {
+ /** @var string $key */
+ /** @var string $value */
+
+ $key = sanitize_text_field( stripslashes( $key ) );
+ $value = sanitize_text_field( stripslashes( $value ) );
+
+ $key = simpay_truncate_metadata( 'title', $key );
+ $value = simpay_truncate_metadata( 'description', $value );
+
+ $_metadata[ $key ] = $value;
+ }
+
+ /** @var array $_metadata */
+ return $_metadata;
+ }
+
+ /**
+ * Returns the payment method types available for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array
+ */
+ public static function get_payment_method_types( $request ) {
+ $form = self::get_form( $request );
+ $price = self::get_price( $request );
+
+ $currency = $price->currency;
+ $recurring = null !== $price->recurring && false === $price->can_recur;
+
+ $is_optionally_recurring = self::is_optionally_recurring( $request );
+
+ /** @var array<\SimplePay\Pro\Payment_Methods\Payment_Method> */
+ $payment_methods = Payment_Methods\get_form_payment_methods( $form );
+
+ // Remove Payment Methods that do not support the current currency.
+ $payment_methods = array_filter(
+ $payment_methods,
+ function( $payment_method ) use ( $currency ) {
+ return in_array( $currency, $payment_method->currencies, true );
+ }
+ );
+
+ // Remove Payment Methods that do not support the current recurring options
+ // if recurring is being used.
+ if ( true === $recurring || true === $is_optionally_recurring ) {
+ $payment_methods = array_filter(
+ $payment_methods,
+ /**
+ * Determines if the given Payment Method supports recurring payments.
+ *
+ * @since unknown
+ *
+ * @param \SimplePay\Pro\Payment_Methods\Payment_Method $payment_method The Payment Method.
+ * @return bool
+ */
+ function( $payment_method ) {
+ // Check for Stripe Checkout-specific overrides first.
+ if (
+ is_array( $payment_method->stripe_checkout ) &&
+ isset( $payment_method->stripe_checkout['recurring'] )
+ ) {
+ return true === $payment_method->stripe_checkout['recurring'];
+ }
+
+ // Check general recurring capabilities.
+ return true === $payment_method->recurring;
+ }
+ );
+ }
+
+ $payment_methods = array_map(
+ function( $payment_method_id ) {
+ switch ( $payment_method_id ) {
+ case 'ach-debit':
+ return 'us_bank_account';
+ default:
+ return str_replace( '-', '_', $payment_method_id );
+ }
+ },
+ array_keys( $payment_methods )
+ );
+
+ // Check the Card configuration and enable Link, if needed.
+ // Do not add if using Stripe Checkout.
+ if ( 'stripe_checkout' !== $form->get_display_type() ) {
+ $custom_fields = get_custom_fields( $form->id );
+ $settings = isset( $custom_fields['email'] )
+ ? $custom_fields['email']
+ : array();
+
+ $link_enabled = isset(
+ $settings['link'],
+ $settings['link']['enabled']
+ )
+ ? 'yes' === $settings['link']['enabled']
+ : false;
+
+ if ( in_array( 'card', $payment_methods, true ) && $link_enabled ) {
+ $payment_methods[] = 'link';
+ }
+ }
+
+ return $payment_methods;
+ }
+
+ /**
+ * Returns the configuration for available payment method types for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return array>
+ */
+ public static function get_payment_method_options( $request ) {
+ $is_recurring = self::is_recurring( $request );
+ $payment_method_types = self::get_payment_method_types( $request );
+ $payment_method_options = array(
+ 'card' => array(
+ 'setup_future_usage' => 'off_session',
+ ),
+ 'link' => array(
+ 'setup_future_usage' => 'off_session',
+ ),
+ 'sepa_debit' => array(
+ 'setup_future_usage' => 'off_session',
+ ),
+ 'us_bank_account' => array(
+ 'verification_method' => 'instant',
+ 'setup_future_usage' => 'off_session',
+ ),
+ );
+
+ // Remove `setup_future_usage` if the form is recurring. This gets set
+ // at the Subscription's top level `off_session=true` parameter instead.
+ $payment_method_options = array_map(
+ function ( $payment_method_options ) use ( $is_recurring ) {
+ if ( true === $is_recurring ) {
+ unset( $payment_method_options['setup_future_usage'] );
+ }
+
+ return $payment_method_options;
+ },
+ $payment_method_options
+ );
+
+ // Filter out payment methods that are not available for the given request.
+ return array_filter(
+ $payment_method_options,
+ function( $payment_method_type ) use ( $payment_method_types ) {
+ return in_array( $payment_method_type, $payment_method_types, true );
+ },
+ ARRAY_FILTER_USE_KEY
+ );
+ }
+
+ /**
+ * Returns the payment method type for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return string
+ */
+ public static function get_payment_method_type( $request ) {
+ /** @var string $payment_method_type */
+ $payment_method_type = $request->get_param( 'payment_method_type' );
+
+ return $payment_method_type;
+ }
+
+ /**
+ * Returns the URL to redirect to after a successful payment.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return string
+ */
+ public static function get_return_url( $request ) {
+ $form = self::get_form( $request );
+ $return_url = esc_url_raw( $form->payment_success_page );
+
+ if ( ! wp_http_validate_url( $return_url ) ) {
+ $return_url = add_query_arg(
+ array(
+ 'form_id' => $form->id,
+ ),
+ esc_url_raw( home_url() )
+ );
+ }
+
+ return $return_url;
+ }
+
+ /**
+ * Returns the URL to redirect to if a payment is cancelled.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @return string
+ */
+ public static function get_cancel_url( $request ) {
+ $form = self::get_form( $request );
+ $cancel_url = esc_url_raw( $form->payment_cancelled_page );
+
+ if ( empty( $cancel_url ) ) {
+ $cancel_url = esc_url_raw( home_url() );
+ }
+
+ return $cancel_url;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/SchemaSanitizationUtils.php b/src/RestApi/Internal/Payment/Utils/SchemaSanitizationUtils.php
new file mode 100644
index 00000000..e8b577cd
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/SchemaSanitizationUtils.php
@@ -0,0 +1,39 @@
+> $value The `form_values` parameter value.
+ * @return array> The sanitized form values.
+ */
+ public static function sanitize_form_values_arg( $value ) {
+ foreach ( $value as $key => $val ) {
+ $value[ sanitize_text_field( $key ) ] = is_array( $val )
+ ? array_map( 'sanitize_text_field', $val )
+ : sanitize_text_field( $val );
+ }
+
+ return $value;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/SchemaUtils.php b/src/RestApi/Internal/Payment/Utils/SchemaUtils.php
new file mode 100644
index 00000000..83675ec5
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/SchemaUtils.php
@@ -0,0 +1,621 @@
+ $args Argument overrides.
+ * @return array
+ */
+ public static function get_form_id_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'integer',
+ 'required' => true,
+ 'description' => __(
+ 'The payment form ID to use for the payment.',
+ 'stripe'
+ ),
+ 'validate_callback' => array(
+ SchemaValidationUtils::class,
+ 'validate_form_id_arg',
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `form_values` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_form_values_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'object',
+ 'required' => true,
+ 'description' => __(
+ 'The payment form values to use for the payment.',
+ 'stripe'
+ ),
+ 'validate_callback' => array(
+ SchemaValidationUtils::class,
+ 'validate_form_values_arg',
+ ),
+ 'sanitize_callback' => array(
+ SchemaSanitizationUtils::class,
+ 'sanitize_form_values_arg',
+ ),
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `token` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_token_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => false,
+ 'description' => __(
+ 'A security token (usually from a CAPTCHA service) to verify the payment request.',
+ 'stripe'
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ // Instead of using a custom `validate_callback` we perform validation manually
+ // in the payment request so we can display a more specific error message.
+ 'validate_callback' => 'rest_validate_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `price_id` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_price_id_schema( $args = array() ) {
+ return wp_parse_args(
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The ID of the price to use for the payment.',
+ 'stripe'
+ ),
+ 'validate_callback' => array(
+ SchemaValidationUtils::class,
+ 'validate_price_id_arg',
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `quantity` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_quantity_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'integer',
+ 'minimum' => 1,
+ 'required' => true,
+ 'description' => __(
+ 'The purchase quantity for the payment.',
+ 'stripe'
+ ),
+ 'validate_callback' => array(
+ SchemaValidationUtils::class,
+ 'validate_quantity_arg',
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `custom_amount` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_custom_amount_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'integer',
+ 'required' => false,
+ 'description' => __(
+ 'The custom amount for the payment.',
+ 'stripe'
+ ),
+ 'validate_callback' => array(
+ SchemaValidationUtils::class,
+ 'validate_custom_amount_arg',
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `currency` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_currency_schema( $args = array() ) {
+ /** @var string $default_currency */
+ $default_currency = simpay_get_setting( 'currency', 'USD' );
+ $default_currency = strtolower( $default_currency );
+
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => false,
+ 'description' => __(
+ 'The currency for the payment.',
+ 'stripe'
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'enum' => array_map(
+ 'strtolower',
+ array_keys( simpay_get_currencies() )
+ ),
+ 'default' => $default_currency,
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `is_optionally_recurring` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_is_optionally_recurring_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'boolean',
+ 'required' => false,
+ 'description' => __(
+ 'If the user has opted in to a recurring payment.',
+ 'stripe'
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ 'validate_callback' => 'rest_validate_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `is_covering_fees` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_is_covering_fees_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'boolean',
+ 'required' => false,
+ 'description' => __(
+ 'If the user has opted in to pay processing fees.',
+ 'stripe'
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ 'validate_callback' => 'rest_validate_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `coupon_code` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_coupon_code_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => false,
+ 'description' => __(
+ 'The coupon code to apply to the payment.',
+ 'stripe'
+ ),
+ // @todo validate it can apply to form
+ 'validate_callback' => array(
+ SchemaValidationUtils::class,
+ 'validate_coupon_code_arg',
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `subtotal` parameter.
+ *
+ * Currently this is only used when previewing coupon validation.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_subtotal_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'integer',
+ 'required' => false,
+ 'description' => __(
+ 'The subtotal of the payment.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `billing_address` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_billing_address_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'object',
+ 'required' => false,
+ 'description' => __(
+ 'The customers\'s billing address.',
+ 'stripe'
+ ),
+ 'properties' => array_merge(
+ array(
+ 'name' => array(
+ 'description' => __( 'Name.', 'stripe' ),
+ 'type' => 'string',
+ ),
+ ),
+ self::get_address_fields_schema()
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ 'validate_callback' => 'rest_validate_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `shipping_address` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_shipping_address_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'object',
+ 'required' => false,
+ 'description' => __(
+ 'The customers\'s shipping address.',
+ 'stripe'
+ ),
+ 'properties' => array_merge(
+ array(
+ 'name' => array(
+ 'description' => __( 'Recipient name.', 'stripe' ),
+ 'type' => 'string',
+ ),
+ 'phone' => array(
+ 'description' => __( 'Recipient phone number.', 'stripe' ),
+ 'type' => 'string',
+ ),
+ ),
+ self::get_address_fields_schema()
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ 'validate_callback' => 'rest_validate_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `payment_method_type` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_payment_method_type_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The payment method type used to make a payment.',
+ 'stripe'
+ ),
+ 'validate_callback' => array(
+ SchemaValidationUtils::class,
+ 'validate_payment_method_type_arg',
+ ),
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `customer_id` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_customer_id_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The payment\'s customer.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `subscription_id` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_subscription_id_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The payment\'s subscription ID.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `setup_intent_id` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_setup_intent_id_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The payment\'s setup intent ID.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `payment_method_id` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_payment_method_id_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The payment method\'s ID.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `subscription_key` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_subscription_key_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The payment\'s subscription key.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `object_id` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_object_id_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => true,
+ 'description' => __(
+ 'The payment object to update.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for the `tax_calc_id` parameter.
+ *
+ * @since 4.7.0
+ *
+ * @param array $args Argument overrides.
+ * @return array
+ */
+ public static function get_tax_calc_id_schema( $args = array() ) {
+ return wp_parse_args(
+ $args,
+ array(
+ 'type' => 'string',
+ 'required' => false,
+ 'description' => __(
+ 'The payment\'s tax calculation.',
+ 'stripe'
+ ),
+ 'validate_callback' => 'rest_validate_request_arg',
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
+ )
+ );
+ }
+
+ /**
+ * Returns the schema for addresses.
+ *
+ * @since 4.7.0
+ *
+ * @return array
+ */
+ private static function get_address_fields_schema() {
+ return array(
+ 'line1' => array(
+ 'description' => __( 'Address.', 'stripe' ),
+ 'type' => array( 'string', 'null' ),
+ ),
+ 'line2' => array(
+ 'description' => __( 'Apartment, suite, etc.', 'stripe' ),
+ 'type' => array( 'string', 'null' ),
+ ),
+ 'city' => array(
+ 'description' => __( 'City.', 'stripe' ),
+ 'type' => array( 'string', 'null' ),
+ ),
+ 'state' => array(
+ 'description' => __( 'State/County code, or name of the state, county, province, or district.', 'stripe' ),
+ 'type' => array( 'string', 'null' ),
+ ),
+ 'postcode' => array(
+ 'description' => __( 'Postal code.', 'stripe' ),
+ 'type' => array( 'string', 'null' ),
+ ),
+ 'country' => array(
+ 'description' => __( 'Country/Region code in ISO 3166-1 alpha-2 format.', 'stripe' ),
+ 'type' => 'string',
+ ),
+ );
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/SchemaValidationUtils.php b/src/RestApi/Internal/Payment/Utils/SchemaValidationUtils.php
new file mode 100644
index 00000000..40217518
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/SchemaValidationUtils.php
@@ -0,0 +1,475 @@
+has_available_schedule();
+
+ if ( false === $available ) {
+ return false;
+ }
+
+ // Finally, this form ID can be used.
+ return true;
+ }
+
+ /**
+ * Validates that a `payment_method_type` parameter is valid for the given request.
+ *
+ * @since 4.7.0
+ *
+ * @param string $value The `payment_method_type` parameter value.
+ * @param \WP_REST_Request $request The payment request.
+ * @param string $param The parameter name.
+ * @return bool
+ */
+ public static function validate_payment_method_type_arg( $value, $request, $param ) {
+ // First, validate the argument based on its registered schema.
+ $validate = rest_validate_request_arg( $value, $request, $param );
+
+ if ( is_wp_error( $validate ) ) {
+ return false;
+ }
+
+ // Next, validate that the form exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ $form_id = intval( $request->get_param( 'form_id' ) );
+ $form = simpay_get_form( $form_id );
+
+ if ( false === $form ) {
+ return false;
+ }
+
+ // Next, determine if the payment method is enabled.
+ $payment_methods_types = Payment_Methods\get_form_payment_method_ids( $form );
+
+ if ( ! in_array( $value, $payment_methods_types, true ) ) {
+ return false;
+ }
+
+ // Finally, this payment method type can be used.
+ return true;
+ }
+
+ /**
+ * Validates that a `price_id` parameter can be transformed into a PriceOption object.
+ *
+ * @since 4.7.0
+ *
+ * @param string $value The `price_id parameter value.
+ * @param \WP_REST_Request $request The payment request.
+ * @param string $param The parameter name.
+ * @return bool
+ */
+ public static function validate_price_id_arg( $value, $request, $param ) {
+ // First, validate the argument based on its registered schema.
+ $validate = rest_validate_request_arg( $value, $request, $param );
+
+ if ( is_wp_error( $validate ) ) {
+ return false;
+ }
+
+ // Next, validate that the form exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ $form_id = intval( $request->get_param( 'form_id' ) );
+ $form = simpay_get_form( $form_id );
+
+ if ( false === $form ) {
+ return false;
+ }
+
+ // Next, validate that the price exists.
+ $price = simpay_payment_form_prices_get_price_by_id( $form, $value );
+
+ if ( ! $price instanceof PriceOption ) {
+ return false;
+ }
+
+ // Next, determine if a custom amount also needs to be supplied.
+ //
+ // We do not require the `custom_amount` parameter at the schema level...
+ // though we probably could...
+ $custom_amount = intval( $request->get_param( 'custom_amount' ) );
+
+ if ( $price->unit_amount_min && ! $custom_amount ) {
+ return false;
+ }
+
+ // Finally, this price ID can be used.
+ return true;
+ }
+
+ /**
+ * Validates that a `quantity` value is valid stock.
+ *
+ * @since 4.7.0
+ *
+ * @param int $value The `quantity` parameter value.
+ * @param \WP_REST_Request $request The payment request.
+ * @param string $param The parameter name.
+ * @return bool
+ */
+ public static function validate_quantity_arg( $value, $request, $param ) {
+ // First, validate the argument based on its registered schema.
+ $validate = rest_validate_request_arg( $value, $request, $param );
+
+ if ( is_wp_error( $validate ) ) {
+ return false;
+ }
+
+ // Next, validate that the form exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ $form_id = intval( $request->get_param( 'form_id' ) );
+ $form = simpay_get_form( $form_id );
+
+ if ( false === $form ) {
+ return false;
+ }
+
+ // Next, validate that the price exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ /** @var string $price_id */
+ $price_id = $request->get_param( 'price_id' );
+ $price_id = sanitize_text_field( $price_id );
+ $price = simpay_payment_form_prices_get_price_by_id(
+ $form,
+ $price_id
+ );
+
+ if ( ! $price instanceof PriceOption ) {
+ return false;
+ }
+
+ // Next, determine if the price still has enough stock remaining.
+ if ( ! $price->is_in_stock( $value ) ) {
+ return false;
+ }
+
+ // Finally, this quantity can be used.
+ return true;
+ }
+
+ /**
+ * Validates that a `custom_amount` parameter is a valid amount.
+ *
+ * @since 4.7.0
+ *
+ * @param string $value The `custom_amount` parameter value.
+ * @param \WP_REST_Request $request The payment request.
+ * @param string $param The parameter name.
+ * @return bool
+ */
+ public static function validate_custom_amount_arg( $value, $request, $param ) {
+ // First, validate the argument based on its registered schema.
+ $validate = rest_validate_request_arg( $value, $request, $param );
+
+ if ( is_wp_error( $validate ) ) {
+ return false;
+ }
+
+ // Next, validate that the form exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ $form_id = intval( $request->get_param( 'form_id' ) );
+ $form = simpay_get_form( $form_id );
+
+ if ( false === $form ) {
+ return false;
+ }
+
+ // Next, validate that the price exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ /** @var string $price_id */
+ $price_id = $request->get_param( 'price_id' );
+ $price_id = sanitize_text_field( $price_id );
+ $price = simpay_payment_form_prices_get_price_by_id(
+ $form,
+ $price_id
+ );
+
+ if ( ! $price instanceof PriceOption ) {
+ return false;
+ }
+
+ // Next, validate that the price option is a custom amount. If it is not,
+ // do not accept a custom amount.
+ $is_defined_price = simpay_payment_form_prices_is_defined_price(
+ $price->id
+ );
+
+ if ( true === $is_defined_price ) {
+ return false;
+ }
+
+ // Next, validate that the custom amount meets the minimum amount.
+ // Ensure we are comparing integers. I'm not sure why PriceOption
+ // was not setting this previously.
+ $unit_amount_min = intval( $price->unit_amount_min );
+
+ if ( $value < $unit_amount_min ) {
+ return false;
+ }
+
+ // Finally, this custom amount can be used.
+ return true;
+ }
+
+ /**
+ * Validates that a `coupon_code` parameter is valid.
+ *
+ * @since 4.7.0
+ *
+ * @param string $value The `coupon_code` parameter value.
+ * @param \WP_REST_Request $request The payment request.
+ * @param string $param The parameter name.
+ * @return bool
+ */
+ public static function validate_coupon_code_arg( $value, $request, $param ) {
+ // First, validate the argument based on its registered schema.
+ $validate = rest_validate_request_arg( $value, $request, $param );
+
+ if ( is_wp_error( $validate ) ) {
+ return false;
+ }
+
+ // Next, validate that the form exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ $form_id = intval( $request->get_param( 'form_id' ) );
+ $form = simpay_get_form( $form_id );
+
+ if ( false === $form ) {
+ return false;
+ }
+
+ // We have already validated that the coupon won't put the amount
+ // below the minimum amount when applying it via the form.
+ //
+ // Someone using the REST API directly could still apply a coupon that
+ // would put the amount below the minimum amount, but Stripe will reject.
+ // So we don't need to validate that here, just that it applies to the form.
+
+ // Next, if the coupon was created within WP Simple Pay, check the form restrictions.
+ $api_args = $form->get_api_request_args();
+ $coupons = new Coupon_Query(
+ $form->is_livemode(),
+ $api_args['api_key']
+ );
+
+ $coupon = $coupons->get_by_name( $value );
+
+ // ...the coupon was not created within WP Simple Pay, so it is valid,
+ // since it cannot have form restrictions if it was created outside of WP Simple Pay.
+ if ( ! $coupon instanceof Coupon ) {
+ return true;
+ }
+
+ if (
+ $request->get_param( 'price_id' ) &&
+ false === $coupon->applies_to_form( $form->id )
+ ) {
+ return false;
+ }
+
+ // Finally, this coupon can be used.
+ return true;
+ }
+
+ /**
+ * Determines if the REST API request contains all required fields.
+ *
+ * @since 4.7.0
+ *
+ * @param array> $value The `form_values` parameter value.
+ * @param \WP_REST_Request $request The payment request.
+ * @param string $param The parameter name.
+ * @return bool
+ */
+ public static function validate_form_values_arg( $value, $request, $param ) {
+ // First, validate the argument based on its registered schema.
+ $validate = rest_validate_request_arg( $value, $request, $param );
+
+ if ( is_wp_error( $validate ) ) {
+ return false;
+ }
+
+ // Next, validate that the form exists.
+ // When using a parameter inside of a validation function, we do not know
+ // if it has been validated yet. So we need to validate it again.
+ $form_id = intval( $request->get_param( 'form_id' ) );
+ $form = simpay_get_form( $form_id );
+
+ if ( false === $form ) {
+ return false;
+ }
+
+ // Next, check for required fields.
+
+ /** @var array> $custom_fields */
+ $custom_fields = simpay_get_saved_meta( $form->id, '_custom_fields' );
+
+ /** @var array $form_values */
+ $form_values = $value;
+
+ $always_required = array(
+ 'email',
+ 'address',
+ );
+
+ foreach ( $custom_fields as $custom_field_type => $custom_field_types ) {
+ foreach ( $custom_field_types as $field ) {
+ /** @var array $field */
+ if (
+ ! in_array( $custom_field_type, $always_required, true ) &&
+ ! isset( $field['required'] )
+ ) {
+ continue;
+ }
+
+ // Check custom fields.
+ if ( isset( $field['metadata'] ) ) {
+ if ( empty( $field['metadata'] ) ) {
+ $id = isset( $field['uid'] )
+ ? $field['uid']
+ : '';
+
+ $meta_key = 'simpay-form-' . $form->id . '-field-' . $id;
+ } else {
+ $meta_key = $field['metadata'];
+ }
+
+ if ( ! isset( $form_values['simpay_field'][ $meta_key ] ) ) {
+ return false;
+ }
+
+ $value = trim( $form_values['simpay_field'][ $meta_key ] );
+
+ if ( empty( $value ) ) {
+ return false;
+ }
+ }
+
+ // Check Customer fields.
+ switch ( $custom_field_type ) {
+ case 'tax_id':
+ if (
+ ! isset( $form_values['simpay_tax_id'] ) ||
+ ! isset( $form_values['simpay_tax_id_type'] )
+ ) {
+ return false;
+ }
+
+ /** @var string $tax_id */
+ $tax_id = $form_values['simpay_tax_id'];
+
+ /** @var string $tax_type */
+ $tax_type = $form_values['simpay_tax_id_type'];
+
+ $tax_id = trim( $tax_id );
+ $tax_type = trim( $tax_type );
+
+ if ( empty( $tax_id ) || empty( $tax_type ) ) {
+ return false;
+ }
+
+ break;
+ case 'address':
+ $address_type = (
+ isset( $field['collect-shipping'] ) &&
+ 'yes' === $field['collect-shipping']
+ )
+ ? 'shipping'
+ : 'billing';
+
+ /** @var array> $address */
+ $address = $request->get_param( $address_type . '_address' );
+
+ if ( ! isset( $address['name'] ) ) {
+ return false;
+ }
+
+ if ( ! isset( $address['address']['country'] ) ) {
+ return false;
+ }
+
+ if ( ! isset( $address['address']['postal_code'] ) ) {
+ return false;
+ }
+
+ break;
+ case 'email':
+ case 'customer_name':
+ case 'telephone':
+ if ( ! isset( $form_values[ 'simpay_' . $custom_field_type ] ) ) {
+ return false;
+ }
+
+ /** @var string $value */
+ $value = $form_values[ 'simpay_' . $custom_field_type ];
+ $value = trim( $value );
+
+ if ( empty( $value ) ) {
+ return false;
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Finally, these values can be used.
+ return true;
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/TaxUtils.php b/src/RestApi/Internal/Payment/Utils/TaxUtils.php
new file mode 100644
index 00000000..4de48f65
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/TaxUtils.php
@@ -0,0 +1,166 @@
+ $object_args The object arguments.
+ * @return array
+ */
+ public static function add_automatic_tax_args( $request, $object_args ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+
+ if ( 'automatic' !== $tax_status ) {
+ return $object_args;
+ }
+
+ $object_args['automatic_tax'] = array(
+ 'enabled' => true,
+ );
+
+ return $object_args;
+ }
+
+ /**
+ * Adds fixed tax rates for the given line items and request.
+ *
+ * Unlike `FeeRecoveryUtils::add_subscription_fee_recovery_line_items()`, this
+ * method needs to work for arbitrary line item parameters. Fee Recovery can
+ * do this because Fee Recovery is not compatible with Stripe Checkout.
+ *
+ * Checkout Session: `line_items=`.
+ * Subscription: `add_invoice_items=`, and `items=`.
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @param array $line_items Line items to add tax information.
+ * @return array
+ */
+ public static function add_tax_rates_to_line_items( $request, $line_items ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $tax_rates = simpay_get_payment_form_tax_rates( $form );
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+
+ // If using fixed tax rates, add them to the line items.
+ if ( ! ( empty( $tax_status ) || 'fixed-global' === $tax_status ) ) {
+ return $line_items;
+ }
+
+ $tax_rates = simpay_get_payment_form_tax_rates( $form );
+ $tax_rate_ids = ! empty( $tax_rates )
+ ? wp_list_pluck( $tax_rates, 'id' )
+ : array();
+
+ $line_items = array_map(
+ function( $line_item ) use ( $tax_rate_ids ) {
+ /** @var array $line_item */
+ $line_item['tax_rates'] = $tax_rate_ids;
+
+ return $line_item;
+ },
+ $line_items
+ );
+
+ return $line_items;
+ }
+
+ /**
+ * Returns the tax amount for the given request, and amount.
+ *
+ * @since 4.7.0
+ *
+ * @param \WP_REST_Request $request The payment request.
+ * @param int $amount_to_tax The amount to calculate the tax amount for.
+ * @return int
+ */
+ public static function get_tax_unit_amount( $request, $amount_to_tax ) {
+ $form = PaymentRequestUtils::get_form( $request );
+ $tax_status = get_post_meta( $form->id, '_tax_status', true );
+
+ // No tax.
+ if ( 'none' === $tax_status ) {
+ return 0;
+ }
+
+ // Automatic tax.
+ $tax_calc_id = PaymentRequestUtils::get_tax_calc_id( $request );
+
+ if ( 'automatic' === $tax_status && ! empty( $tax_calc_id ) ) {
+ $tax_line_items = Stripe_API::request(
+ 'Tax\Calculation',
+ 'allLineItems',
+ $tax_calc_id,
+ $form->get_api_request_args()
+ );
+
+ return array_reduce(
+ $tax_line_items->data,
+ function( $total, $tax_line_item ) {
+ return $total + $tax_line_item->amount_tax;
+ },
+ 0
+ );
+ }
+
+ // Fixed rates.
+ $tax_rates = simpay_get_payment_form_tax_rates( $form );
+
+ if ( empty( $tax_rates ) ) {
+ return 0;
+ }
+
+ // Remove inclusive tax amount.
+ $inclusive_tax_amount = array_reduce(
+ $tax_rates,
+ function( $amount, $tax_rate ) use ( $amount_to_tax ) {
+ if ( 'exclusive' === $tax_rate->calculation ) {
+ return $amount;
+ }
+
+ return $amount + ( $amount_to_tax * ( $tax_rate->percentage / 100 ) );
+ },
+ 0
+ );
+
+ $post_inclusive_unit_amount = round( $amount_to_tax - $inclusive_tax_amount );
+
+ $tax = array_reduce(
+ $tax_rates,
+ function( $tax, $tax_rate ) use ( $post_inclusive_unit_amount ) {
+ if ( 'inclusive' === $tax_rate->calculation ) {
+ return $tax;
+ }
+
+ $tax_rate = $tax_rate->percentage / 100;
+
+ return $tax + ( $post_inclusive_unit_amount * $tax_rate );
+ },
+ 0
+ );
+
+ return (int) round( $tax );
+ }
+
+}
diff --git a/src/RestApi/Internal/Payment/Utils/TokenValidationUtils.php b/src/RestApi/Internal/Payment/Utils/TokenValidationUtils.php
new file mode 100644
index 00000000..682432b2
--- /dev/null
+++ b/src/RestApi/Internal/Payment/Utils/TokenValidationUtils.php
@@ -0,0 +1,159 @@
+get_param( 'token' );
+ $existing_recaptcha = simpay_get_setting( 'recaptcha_site_key', '' );
+ $default = ! empty( $existing_recaptcha )
+ ? 'recaptcha-v3'
+ : '';
+ $type = simpay_get_setting( 'captcha_type', $default );
+
+ switch ( $type ) {
+ case 'recaptcha-v3':
+ return self::validate_recaptcha_v3_token( $token );
+ case 'hcaptcha':
+ return self::validate_hcaptcha_token( $token );
+ default:
+ return true;
+ }
+ }
+
+ /**
+ * Validates a Google reCAPTCHA v3 token.
+ *
+ * @since 4.7.0
+ *
+ * @param string $token The CAPTCHA token.
+ * @return bool
+ */
+ private static function validate_recaptcha_v3_token( $token ) {
+ $request = wp_remote_post(
+ 'https://www.google.com/recaptcha/api/siteverify',
+ array(
+ 'body' => array(
+ 'secret' => simpay_get_setting( 'recaptcha_secret_key' ),
+ 'response' => $token,
+ 'remoteip' => Utils\get_current_ip_address(),
+ ),
+ )
+ );
+
+ // Request fails.
+ if ( is_wp_error( $request ) ) {
+ return false;
+ }
+
+ $response = json_decode( wp_remote_retrieve_body( $request ), true );
+
+ // No score available.
+ if ( ! isset( $response['score'] ) ) {
+ return false;
+ }
+
+ // Actions do not match.
+ if (
+ isset( $response['action'] ) &&
+ 'simpay_payment' !== $response['action']
+ ) {
+ return false;
+ }
+
+ $threshold = simpay_get_setting(
+ 'recaptcha_score_threshold',
+ 'aggressive'
+ );
+
+ switch ( $threshold ) {
+ case 'aggressive':
+ $minimum_score = '0.80';
+ break;
+ default:
+ $minimum_score = '0.50';
+ }
+
+ /**
+ * Filter the minimum score allowed for a reCAPTCHA response to allow form submission.
+ *
+ * @since 3.9.6
+ *
+ * @param string $minimum_score Minumum score.
+ */
+ $minimum_score = apply_filters( 'simpay_recpatcha_minimum_score', $minimum_score );
+
+ return floatval( $response['score'] ) >= floatval( $minimum_score );
+ }
+
+ /**
+ * Validates an hCaptcha token.
+ *
+ * @since 4.7.0
+ *
+ * @param string $token The CAPTCHA token.
+ * @return bool
+ */
+ private static function validate_hcaptcha_token( $token ) {
+ $request = wp_remote_post(
+ 'https://hcaptcha.com/siteverify',
+ array(
+ 'body' => array(
+ 'secret' => simpay_get_setting( 'hcaptcha_secret_key', '' ),
+ 'response' => $token,
+ 'sitekey' => simpay_get_setting( 'hcaptcha_site_key', '' ),
+ 'remoteip' => Utils\get_current_ip_address(),
+ ),
+ )
+ );
+
+ // Request fails.
+ if ( is_wp_error( $request ) ) {
+ return false;
+ }
+
+ $response = wp_remote_retrieve_body( $request );
+
+ if ( empty( $response ) ) {
+ return false;
+ }
+
+ $response = json_decode( $response );
+
+ if ( null === $response ) {
+ return false;
+ }
+
+ return $response->success;
+ }
+}
diff --git a/src/RestApi/Internal/Report/DashboardWidgetReport.php b/src/RestApi/Internal/Report/DashboardWidgetReport.php
index 928967d5..336b915b 100644
--- a/src/RestApi/Internal/Report/DashboardWidgetReport.php
+++ b/src/RestApi/Internal/Report/DashboardWidgetReport.php
@@ -43,8 +43,8 @@ public function get_subscribed_events() {
*/
public function register_route() {
register_rest_route(
- 'wpsp/__internal__/report',
- 'dashboard-widget',
+ 'wpsp/__internal__',
+ 'report/dashboard-widget',
array(
array(
'methods' => WP_REST_Server::READABLE,
diff --git a/src/RestApi/Internal/Report/GrossVolumePeriodOverPeriodReport.php b/src/RestApi/Internal/Report/GrossVolumePeriodOverPeriodReport.php
index deb97460..cff23c1c 100644
--- a/src/RestApi/Internal/Report/GrossVolumePeriodOverPeriodReport.php
+++ b/src/RestApi/Internal/Report/GrossVolumePeriodOverPeriodReport.php
@@ -47,8 +47,8 @@ public function get_subscribed_events() {
*/
public function register_route() {
register_rest_route(
- 'wpsp/__internal__/report',
- 'gross-volume-period-over-period',
+ 'wpsp/__internal__',
+ 'report/gross-volume-period-over-period',
array(
array(
'methods' => WP_REST_Server::READABLE,
diff --git a/src/RestApi/Internal/Report/LatestPaymentsReport.php b/src/RestApi/Internal/Report/LatestPaymentsReport.php
index 99e56db4..34e2b1d8 100644
--- a/src/RestApi/Internal/Report/LatestPaymentsReport.php
+++ b/src/RestApi/Internal/Report/LatestPaymentsReport.php
@@ -43,8 +43,8 @@ public function get_subscribed_events() {
*/
public function register_route() {
register_rest_route(
- 'wpsp/__internal__/report',
- 'latest-payments',
+ 'wpsp/__internal__',
+ 'report/latest-payments',
array(
array(
'methods' => WP_REST_Server::READABLE,
@@ -211,13 +211,17 @@ private function get_payment_method_type_icon( $payment_method_type ) {
return '';
}
- $payment_method = $payment_methods->get_item( $payment_method_type );
+ if ( 'link' === $payment_method_type ) {
+ return '';
+ } else {
+ $payment_method = $payment_methods->get_item( $payment_method_type );
- if ( ! $payment_method instanceof Payment_Method ) {
- return '';
- }
+ if ( ! $payment_method instanceof Payment_Method ) {
+ return '';
+ }
- return $payment_method->icon_sm;
+ return $payment_method->icon_sm;
+ }
}
}
diff --git a/src/RestApi/Internal/Report/PaymentInfoReport.php b/src/RestApi/Internal/Report/PaymentInfoReport.php
index 48b17d1d..d9983324 100644
--- a/src/RestApi/Internal/Report/PaymentInfoReport.php
+++ b/src/RestApi/Internal/Report/PaymentInfoReport.php
@@ -43,8 +43,8 @@ public function get_subscribed_events() {
*/
public function register_route() {
register_rest_route(
- 'wpsp/__internal__/report',
- 'payment-info',
+ 'wpsp/__internal__',
+ 'report/payment-info',
array(
array(
'methods' => WP_REST_Server::READABLE,
@@ -247,13 +247,17 @@ private function get_payment_method_type_label( $payment_method_type ) {
return __( 'Card', 'stripe' );
}
- $payment_method = $payment_methods->get_item( $payment_method_type );
+ if ( 'link' === $payment_method_type ) {
+ return 'Link';
+ } else {
+ $payment_method = $payment_methods->get_item( $payment_method_type );
- if ( ! $payment_method instanceof Payment_Method ) {
- return '';
- }
+ if ( ! $payment_method instanceof Payment_Method ) {
+ return '';
+ }
- return $payment_method->nicename;
+ return $payment_method->nicename;
+ }
}
/**
@@ -282,6 +286,8 @@ private function get_payment_method_type_color( $payment_method_type ) {
return '#cc0166';
case 'klarna':
return '#ffb3c7';
+ case 'link':
+ return '#33ddb3';
case 'p24':
return '#d40f2b';
case 'sepa_debit':
diff --git a/src/RestApi/Internal/Report/SuccessfulPaymentsPeriodOverPeriodReport.php b/src/RestApi/Internal/Report/SuccessfulPaymentsPeriodOverPeriodReport.php
index fcce9c5c..52ad46b5 100644
--- a/src/RestApi/Internal/Report/SuccessfulPaymentsPeriodOverPeriodReport.php
+++ b/src/RestApi/Internal/Report/SuccessfulPaymentsPeriodOverPeriodReport.php
@@ -47,8 +47,8 @@ public function get_subscribed_events() {
*/
public function register_route() {
register_rest_route(
- 'wpsp/__internal__/report',
- 'successful-payments-period-over-period',
+ 'wpsp/__internal__',
+ 'report/successful-payments-period-over-period',
array(
array(
'methods' => WP_REST_Server::READABLE,
diff --git a/src/RestApi/Internal/Report/TodayReport.php b/src/RestApi/Internal/Report/TodayReport.php
index 466111d0..e4888bc7 100644
--- a/src/RestApi/Internal/Report/TodayReport.php
+++ b/src/RestApi/Internal/Report/TodayReport.php
@@ -47,8 +47,8 @@ public function get_subscribed_events() {
*/
public function register_route() {
register_rest_route(
- 'wpsp/__internal__/report',
- 'today',
+ 'wpsp/__internal__',
+ 'report/today',
array(
array(
'methods' => WP_REST_Server::READABLE,
diff --git a/src/RestApi/RestApiServiceProvider.php b/src/RestApi/RestApiServiceProvider.php
index 027d999f..4afefcc5 100644
--- a/src/RestApi/RestApiServiceProvider.php
+++ b/src/RestApi/RestApiServiceProvider.php
@@ -13,13 +13,17 @@
use Exception;
use SimplePay\Core\AbstractPluginServiceProvider;
+use SimplePay\Core\License\LicenseAwareInterface;
+use SimplePay\Core\License\LicenseAwareTrait;
/**
* RestApiServiceProvider class.
*
* @since 4.4.5
*/
-class RestApiServiceProvider extends AbstractPluginServiceProvider {
+class RestApiServiceProvider extends AbstractPluginServiceProvider implements LicenseAwareInterface {
+
+ use LicenseAwareTrait;
/**
* {@inheritdoc}
@@ -33,7 +37,17 @@ public function get_services() {
*/
public function get_subscribers() {
return array(
+ // Internal: payment.
+ 'rest-api-internal-payment-create',
+ 'rest-api-internal-payment-update',
+ 'rest-api-internal-payment-validate-coupon',
+ 'rest-api-internal-payment-calculate-tax',
+ 'rest-api-internal-payment-update-payment-method',
+
+ // Internal: notifications.
'rest-api-unstable-notifications',
+
+ // Internal: reports.
'rest-api-internal-report-dashboard-widget-report',
'rest-api-internal-report-today',
'rest-api-internal-report-latest-payments',
@@ -48,6 +62,47 @@ public function get_subscribers() {
*/
public function register() {
$container = $this->getContainer();
+ /** @var \SimplePay\Core\License\License */
+ $license = $container->get( 'license' );
+
+ // UPE routes.
+ if ( simpay_is_upe() ) {
+
+ // Payment create (depending on which plugin).
+ $container->share(
+ 'rest-api-internal-payment-create',
+ $license->is_lite()
+ ? Internal\Payment\LitePaymentCreateRoute::class
+ : Internal\Payment\ProPaymentCreateRoute::class
+ )
+ ->withArgument(
+ $container->get( 'stripe-connect-application-fee' )
+ );
+
+ // Additional payment routes for Pro.
+ if ( false === $license->is_lite() ) {
+ $container->share(
+ 'rest-api-internal-payment-update',
+ Internal\Payment\PaymentUpdateRoute::class
+ );
+
+ $container->share(
+ 'rest-api-internal-payment-validate-coupon',
+ Internal\Payment\ValidateCouponRoute::class
+ );
+
+ $container->share(
+ 'rest-api-internal-payment-calculate-tax',
+ Internal\Payment\TaxCalculationRoute::class
+ );
+ }
+ }
+
+ // Update payment method.
+ $container->share(
+ 'rest-api-internal-payment-update-payment-method',
+ Internal\Payment\UpdatePaymentMethodRoute::class
+ );
// Notifications.
try {
diff --git a/src/RestApi/__UnstableNotifications.php b/src/RestApi/__UnstableNotifications.php
index 83c61de0..a4e464bb 100644
--- a/src/RestApi/__UnstableNotifications.php
+++ b/src/RestApi/__UnstableNotifications.php
@@ -54,7 +54,7 @@ public function get_subscribed_events() {
}
/**
- * Registers the REST API route for GET /wpsp/v2/notifications.
+ * Registers the REST API route for GET /wpsp/__internal__/notifications.
*
* @since 4.4.5
*
@@ -62,7 +62,7 @@ public function get_subscribed_events() {
*/
public function register_route() {
register_rest_route(
- 'wpsp/v2',
+ 'wpsp/__internal__',
'notifications',
array(
array(
@@ -95,7 +95,7 @@ public function register_route() {
);
register_rest_route(
- 'wpsp/v2',
+ 'wpsp/__internal__',
'notifications/(?P\d+)',
array(
array(
diff --git a/src/StripeConnect/ApplicationFee.php b/src/StripeConnect/ApplicationFee.php
index 6bc2e5f9..f212a379 100644
--- a/src/StripeConnect/ApplicationFee.php
+++ b/src/StripeConnect/ApplicationFee.php
@@ -16,7 +16,6 @@
use SimplePay\Core\EventManagement\SubscriberInterface;
use SimplePay\Core\License\LicenseAwareInterface;
use SimplePay\Core\License\LicenseAwareTrait;
-use SimplePay\Core\Payments\Stripe_Checkout\Session;
use SimplePay\Core\Scheduler\SchedulerInterface;
use SimplePay\Core\Settings;
use SimplePay\Core\Transaction\TransactionRepository;
@@ -65,19 +64,11 @@ public function __construct(
* {@inheritdoc}
*/
public function get_subscribed_events() {
- return array(
+ $subscribers = array(
// Display a notice that an additional fee is being charged.
'__unstable_simpay_stripe_connect_account_message' =>
'maybe_show_application_fee',
- // Add application fee to one time and subscription payments.
- 'simpay_get_paymentintent_args_from_payment_form_request' =>
- 'maybe_add_one_time_application_fee',
- 'simpay_get_order_args_from_payment_form_request' =>
- array( 'maybe_add_one_time_order_application_fee', 10, 2 ),
- 'simpay_get_subscription_args_from_payment_form_request' =>
- 'maybe_add_subscription_application_fee',
-
// Queues transaction records recorded with an application fee for
// possible update to remove the application fee if the license is
// now valid.
@@ -88,6 +79,22 @@ public function get_subscribed_events() {
'simpay_remove_application_fees' =>
'remove_application_fees',
);
+
+ // Not using UPE, use the old method of adding application fees.
+ // Otherwise the application fees are added directly during the pament creation
+ // in the UPE flow.
+ if ( ! simpay_is_upe() ) {
+ $subscribers['simpay_get_paymentintent_args_from_payment_form_request'] =
+ 'maybe_add_one_time_application_fee';
+
+ $subscribers['simpay_get_order_args_from_payment_form_request'] =
+ array( 'maybe_add_one_time_order_application_fee', 10, 2 );
+
+ $subscribers['simpay_get_subscription_args_from_payment_form_request'] =
+ 'maybe_add_subscription_application_fee';
+ }
+
+ return $subscribers;
}
/**
@@ -165,6 +172,29 @@ public function maybe_show_application_fee( $message ) {
return $message;
}
+ /**
+ * Returns the application fee percentage.
+ *
+ * @since 4.7.0
+ *
+ * @return int
+ */
+ public function get_application_fee_percentage() {
+ return 3;
+ }
+
+ /**
+ * Returns an application fee amount for a given amount.
+ *
+ * @since 4.7.0
+ *
+ * @param int $amount Amount to calculate the application fee for.
+ * @return float
+ */
+ public function get_application_fee_amount( $amount ) {
+ return round( $amount * ( $this->get_application_fee_percentage() / 100 ), 0 );
+ }
+
/**
* Adds an application fee to Checkout Session and PaymentIntent arguments.
*
@@ -179,7 +209,7 @@ public function maybe_add_one_time_application_fee( $payment_intent_args ) {
}
$payment_intent_args['application_fee_amount'] = round(
- $payment_intent_args['amount'] * 0.03,
+ $payment_intent_args['amount'] * ( $this->get_application_fee_percentage() / 100 ),
0
);
@@ -207,7 +237,7 @@ public function maybe_add_one_time_order_application_fee( $order_args, $order )
}
$order_args['payment']['settings']['application_fee_amount'] = round(
- $order->amount_total * 0.03,
+ $order->amount_total * ( $this->get_application_fee_percentage() / 100 ),
0
);
@@ -227,7 +257,7 @@ public function maybe_add_subscription_application_fee( $subscription_args ) {
return $subscription_args;
}
- $subscription_args['application_fee_percent'] = 3;
+ $subscription_args['application_fee_percent'] = $this->get_application_fee_percentage();
return $subscription_args;
}
@@ -351,7 +381,7 @@ public function remove_application_fees( $transactions ) {
try {
/** @var string $object_id */
$object_id = $txn['object_id'];
- $session = Session\retrieve(
+ $session = API\CheckoutSessions\retrieve(
$object_id,
$api_request_args
);
diff --git a/src/Transaction/TransactionObserver.php b/src/Transaction/TransactionObserver.php
index ff025073..3b40ab2a 100644
--- a/src/Transaction/TransactionObserver.php
+++ b/src/Transaction/TransactionObserver.php
@@ -12,10 +12,10 @@
namespace SimplePay\Core\Transaction;
use Exception;
+use SimplePay\Core\API;
use SimplePay\Core\EventManagement\SubscriberInterface;
use SimplePay\Core\License\LicenseAwareInterface;
use SimplePay\Core\License\LicenseAwareTrait;
-use SimplePay\Core\Payments\Stripe_Checkout\Session;
use SimplePay\Core\StripeConnect\ApplicationFee;
use stdClass;
@@ -137,47 +137,60 @@ public function get_subscribed_events() {
* @return void
*/
public function add_on_payment_intent( $payment_intent, $form, $form_data, $form_values ) {
- $price = simpay_payment_form_prices_get_price_by_id(
- $form,
- $form_data['price']['id'] // @phpstan-ignore-line
- );
+ // Retrieve from metadata if it exists (UPE only).
+ if ( isset(
+ $payment_intent->metadata->simpay_unit_amount,
+ $payment_intent->metadata->simpay_quantity
+ ) ) {
+ $quantity = $payment_intent->metadata->simpay_quantity;
+ $unit_amount = $payment_intent->metadata->simpay_unit_amount;
- if ( false === $price ) {
- return;
- }
+ $subtotal = $unit_amount * $quantity;
- // Custom amount. Verify minimum amount.
- if ( false === simpay_payment_form_prices_is_defined_price( $price->id ) ) {
- // Ensure custom amount meets minimum requirement.
- $unit_amount = $form_data['customAmount'];
+ // Calculate based on the form data (non-UPE).
+ } else {
+ $price = simpay_payment_form_prices_get_price_by_id(
+ $form,
+ $form_data['price']['id'] // @phpstan-ignore-line
+ );
- if ( $unit_amount < $price->unit_amount_min ) {
- $unit_amount = $price->unit_amount_min;
+ if ( false === $price ) {
+ return;
}
- } else {
- $unit_amount = $price->unit_amount;
- }
- /** @var int $unit_amount */
+ // Custom amount. Verify minimum amount.
+ if ( false === simpay_payment_form_prices_is_defined_price( $price->id ) ) {
+ // Ensure custom amount meets minimum requirement.
+ $unit_amount = $form_data['customAmount'];
+
+ if ( $unit_amount < $price->unit_amount_min ) {
+ $unit_amount = $price->unit_amount_min;
+ }
+ } else {
+ $unit_amount = $price->unit_amount;
+ }
- // Backwards compatibility amount filter.
- if ( has_filter( 'simpay_form_' . $form->id . '_amount' ) ) {
/** @var int $unit_amount */
- $unit_amount = simpay_get_filtered(
- 'amount',
- simpay_convert_amount_to_dollars( $unit_amount ),
- $form->id
- );
- $unit_amount = simpay_convert_amount_to_cents( $unit_amount );
- }
+ // Backwards compatibility amount filter.
+ if ( has_filter( 'simpay_form_' . $form->id . '_amount' ) ) {
+ /** @var int $unit_amount */
+ $unit_amount = simpay_get_filtered(
+ 'amount',
+ simpay_convert_amount_to_dollars( $unit_amount ),
+ $form->id
+ );
- // Calculate quantity.
- $quantity = isset( $form_values['simpay_quantity'] )
- ? intval( $form_values['simpay_quantity'] )
- : 1;
+ $unit_amount = simpay_convert_amount_to_cents( $unit_amount );
+ }
- $subtotal = $unit_amount * $quantity;
+ // Calculate quantity.
+ $quantity = isset( $form_values['simpay_quantity'] )
+ ? intval( $form_values['simpay_quantity'] )
+ : 1;
+
+ $subtotal = $unit_amount * $quantity;
+ }
/** @var \SimplePay\Vendor\Stripe\Customer $customer */
$customer = $payment_intent->customer;
@@ -645,7 +658,7 @@ public function update_on_checkout_session_lite( $payment_confirmation_data ) {
}
try {
- $session = Session\retrieve(
+ $session = API\CheckoutSessions\retrieve(
array(
'id' => $session_id,
'expand' => array(
@@ -815,9 +828,14 @@ public function update_on_failed( $event, $charge ) {
/** @var \SimplePay\Vendor\Stripe\PaymentIntent $payment_intent */
$payment_intent = $charge->payment_intent;
+ /** @var \SimplePay\Vendor\Stripe\Invoice $invoice */
+ $invoice = $charge->invoice;
+
// Find from a Subscription.
- if ( $charge->invoice && $charge->invoice->subscription ) {
- $transaction_id = $charge->invoice->subscription->id;
+ if ( $invoice && $invoice->subscription ) {
+ /** @var \SimplePay\Vendor\Stripe\Subscription $subscription */
+ $subscription = $invoice->subscription;
+ $transaction_id = $subscription->id;
// Find from a one time payment.
} else {
@@ -864,23 +882,25 @@ public function maybe_decrement_stock( $object, $form, $form_data, $form_values
}
$behavior = $form->get_inventory_behavior();
- $quantity = isset( $form_values['simpay_quantity'] )
- ? intval( $form_values['simpay_quantity'] )
- : 1;
+ $prices = $object->metadata->simpay_price_instances;
+ $prices = explode( '|', $prices );
switch ( $behavior ) {
case 'combined':
+ $price_option = current( $prices );
+ $price_option_parts = explode( ':', $price_option );
+ $quantity = intval( $price_option_parts[1] );
$form->adjust_inventory( 'decrement', $quantity, null );
break;
case 'individual':
- $price = simpay_payment_form_prices_get_price_by_id(
- $form,
- $form_data['price']['id'] // @phpstan-ignore-line
- );
- if ( false !== $price ) {
- $form->adjust_inventory( 'decrement', $quantity, $price->instance_id );
+ foreach ( $prices as $price_option ) {
+ $price_option_parts = explode( ':', $price_option );
+ $instance_id = $price_option_parts[0];
+ $quantity = intval( $price_option_parts[1] );
+
+ $form->adjust_inventory( 'decrement', $quantity, $instance_id );
}
break;
diff --git a/src/Webhook/NoneReceivedNotice.php b/src/Webhook/NoneReceivedNotice.php
index dba8c442..6a1328e7 100644
--- a/src/Webhook/NoneReceivedNotice.php
+++ b/src/Webhook/NoneReceivedNotice.php
@@ -75,31 +75,34 @@ public function get_subscribed_events() {
// Log when an incoming event should be expected.
'simpay_after_checkout_session_from_payment_form_request' =>
'log_expected_event',
- 'simpay_after_paymentintent_from_payment_form_request' =>
+ 'simpay_after_paymentintent_from_payment_form_request' =>
'log_expected_event',
- 'simpay_after_subscription_from_payment_form_request' =>
+ 'simpay_after_subscription_from_payment_form_request' =>
'log_expected_event',
- 'simpay_after_charge_from_payment_form_request' =>
+ 'simpay_after_charge_from_payment_form_request' =>
'log_expected_event',
// Show a notice in the setting.
- '__unstable_simpay_before_webhook_setting' =>
+ '__unstable_simpay_before_webhook_setting' =>
'maybe_show_setting_notice',
// Clear the "expected" flag when a user claims they have verified their settings.
- 'wpsp_transition_notification_dismissed' =>
+ 'wpsp_transition_notification_dismissed' =>
array( 'clear_expected_event_flag', 10, 3 ),
// Allow permanently dismissing the notice/notification.
- 'admin_init' =>
+ 'admin_init' =>
array(
- array( 'dismiss_expected_event' )
+ array( 'dismiss_expected_event' ),
),
);
- // Alert via Notification Inbox if available.
if ( $this->notifications instanceof NotificationRepository ) {
+ // Alert via Notification Inbox if available.
$subscribers['admin_init'][] = array( 'maybe_add_notification' );
+
+ // Clear the expectations when the Stripe account changes.
+ $subscribers['simpay_stripe_account_connected'] = 'reset_expectations';
}
return $subscribers;
@@ -129,24 +132,28 @@ public function log_expected_event() {
* @return void
*/
public function maybe_add_notification() {
+ // Dismiss the notification if an event was received.
if ( true === $this->received_expected_event() ) {
+ $this->notifications->dismiss( 'webhook-event-expected' );
+
return;
}
+ // Restore (or add) the notification if it was not received.
$this->notifications->restore(
array(
- 'type' => 'error',
- 'source' => 'internal',
- 'title' => __(
+ 'type' => 'error',
+ 'source' => 'internal',
+ 'title' => __(
'An expected webhook event was not received.',
'stripe'
),
- 'slug' => 'webhook-event-expected',
- 'content' => __(
+ 'slug' => 'webhook-event-expected',
+ 'content' => __(
'An expected webhook event has not been received. Please ensure you have properly configured your webhook endpoint in Stripe to avoid interruption of functionality.',
'stripe'
),
- 'actions' => array(
+ 'actions' => array(
array(
'type' => 'primary',
'text' => __( 'Webhook Settings', 'stripe' ),
@@ -155,7 +162,7 @@ public function maybe_add_notification() {
'section' => 'stripe',
'subsection' => 'webhooks',
)
- )
+ ),
),
array(
'type' => 'secondary',
@@ -168,9 +175,9 @@ public function maybe_add_notification() {
),
),
),
- 'conditions' => array(),
- 'start' => date( 'Y-m-d H:i:s', time() ),
- 'end' => date( 'Y-m-d H:i:s', time() + YEAR_IN_SECONDS ),
+ 'conditions' => array(),
+ 'start' => date( 'Y-m-d H:i:s', time() ), // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
+ 'end' => date( 'Y-m-d H:i:s', time() + YEAR_IN_SECONDS ), // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
)
);
}
@@ -230,7 +237,7 @@ public function maybe_show_setting_notice() {
*
* @param mixed $old_value Old value.
* @param mixed $new_value New value.
- * @param int $notification_id Notification ID.
+ * @param int $notification_id Notification ID.
* @return void
*/
public function clear_expected_event_flag( $old_value, $new_value, $notification_id ) {
@@ -262,6 +269,22 @@ public function clear_expected_event_flag( $old_value, $new_value, $notification
delete_option( $option_key );
}
+ /**
+ * Clears webhook expectattions (and dismisses a notification).
+ *
+ * @since 4.7.0
+ *
+ * @return void
+ */
+ public function reset_expectations() {
+ // Clear the flag(s).
+ delete_option( 'simpay_webhook_event_expected_live' );
+ delete_option( 'simpay_webhook_event_expected_test' );
+
+ // Dismiss the notice.
+ $this->notifications->dismiss( 'webhook-event-expected' );
+ }
+
/**
* Permanately dismisses the "No webhooks received" notice.
*
@@ -373,7 +396,7 @@ private function get_most_recent_received_event() {
'number' => 1,
'livemode' => $livemode,
'date_query' => array(
- 'after' => date( 'Y-m-d H:i:s', $expected ),
+ 'after' => date( 'Y-m-d H:i:s', $expected ), // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
),
)
);
diff --git a/stripe-checkout.php b/stripe-checkout.php
index 3adeb677..9d37fb52 100644
--- a/stripe-checkout.php
+++ b/stripe-checkout.php
@@ -5,7 +5,7 @@
* Description: Add high conversion Stripe payment forms to your WordPress site in minutes.
* Author: WP Simple Pay
* Author URI: https://wpsimplepay.com
- * Version: 4.6.7
+ * Version: 4.7.0
* Text Domain: stripe
* Domain Path: /languages
*/
@@ -54,7 +54,7 @@
//
// Lite/Pro-specific.
//
- define( 'SIMPLE_PAY_VERSION', '4.6.7' );
+ define( 'SIMPLE_PAY_VERSION', '4.7.0' );
if ( ! defined( 'SIMPLE_PAY_PLUGIN_NAME' ) ) {
define( 'SIMPLE_PAY_PLUGIN_NAME', 'WP Simple Pay Lite' );
@@ -68,7 +68,7 @@
// Stripe.
//
if ( ! defined( 'SIMPLE_PAY_STRIPE_API_VERSION' ) ) {
- define( 'SIMPLE_PAY_STRIPE_API_VERSION', '2020-08-27' );
+ define( 'SIMPLE_PAY_STRIPE_API_VERSION', '2022-11-15' );
}
if ( ! defined( 'SIMPLE_PAY_STRIPE_PARTNER_ID' ) ) {
diff --git a/vendor/autoload.php b/vendor/autoload.php
index 2954d87e..ce460ee4 100644
--- a/vendor/autoload.php
+++ b/vendor/autoload.php
@@ -2,6 +2,24 @@
// autoload.php @generated by Composer
+if (PHP_VERSION_ID < 50600) {
+ if (!headers_sent()) {
+ header('HTTP/1.1 500 Internal Server Error');
+ }
+ $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
+ if (!ini_get('display_errors')) {
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
+ fwrite(STDERR, $err);
+ } elseif (!headers_sent()) {
+ echo $err;
+ }
+ }
+ trigger_error(
+ $err,
+ E_USER_ERROR
+ );
+}
+
require_once __DIR__ . '/composer/autoload_real.php';
-return ComposerAutoloaderInit8dc43cf8fbf0d1c266f8eaa3e064d435::getLoader();
+return ComposerAutoloaderInit6a66df1ef797fcdfb799866defc62aa2::getLoader();
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index 6d0c3f2d..a72151c7 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -42,30 +42,79 @@
*/
class ClassLoader
{
+ /** @var \Closure(string):void */
+ private static $includeFile;
+
+ /** @var ?string */
private $vendorDir;
// PSR-4
+ /**
+ * @var array[]
+ * @psalm-var array>
+ */
private $prefixLengthsPsr4 = array();
+ /**
+ * @var array[]
+ * @psalm-var array>
+ */
private $prefixDirsPsr4 = array();
+ /**
+ * @var array[]
+ * @psalm-var array
+ */
private $fallbackDirsPsr4 = array();
// PSR-0
+ /**
+ * @var array[]
+ * @psalm-var array>
+ */
private $prefixesPsr0 = array();
+ /**
+ * @var array[]
+ * @psalm-var array
+ */
private $fallbackDirsPsr0 = array();
+ /** @var bool */
private $useIncludePath = false;
+
+ /**
+ * @var string[]
+ * @psalm-var array
+ */
private $classMap = array();
+
+ /** @var bool */
private $classMapAuthoritative = false;
+
+ /**
+ * @var bool[]
+ * @psalm-var array
+ */
private $missingClasses = array();
+
+ /** @var ?string */
private $apcuPrefix;
+ /**
+ * @var self[]
+ */
private static $registeredLoaders = array();
+ /**
+ * @param ?string $vendorDir
+ */
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
+ self::initializeIncludeClosure();
}
+ /**
+ * @return string[]
+ */
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
@@ -75,28 +124,47 @@ public function getPrefixes()
return array();
}
+ /**
+ * @return array[]
+ * @psalm-return array>
+ */
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
+ /**
+ * @return array[]
+ * @psalm-return array
+ */
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
+ /**
+ * @return array[]
+ * @psalm-return array
+ */
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
+ /**
+ * @return string[] Array of classname => path
+ * @psalm-return array
+ */
public function getClassMap()
{
return $this->classMap;
}
/**
- * @param array $classMap Class to filename map
+ * @param string[] $classMap Class to filename map
+ * @psalm-param array $classMap
+ *
+ * @return void
*/
public function addClassMap(array $classMap)
{
@@ -111,9 +179,11 @@ public function addClassMap(array $classMap)
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
- * @param string $prefix The prefix
- * @param array|string $paths The PSR-0 root directories
- * @param bool $prepend Whether to prepend the directories
+ * @param string $prefix The prefix
+ * @param string[]|string $paths The PSR-0 root directories
+ * @param bool $prepend Whether to prepend the directories
+ *
+ * @return void
*/
public function add($prefix, $paths, $prepend = false)
{
@@ -156,11 +226,13 @@ public function add($prefix, $paths, $prepend = false)
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param array|string $paths The PSR-4 base directories
- * @param bool $prepend Whether to prepend the directories
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param string[]|string $paths The PSR-4 base directories
+ * @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
+ *
+ * @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
@@ -204,8 +276,10 @@ public function addPsr4($prefix, $paths, $prepend = false)
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
- * @param string $prefix The prefix
- * @param array|string $paths The PSR-0 base directories
+ * @param string $prefix The prefix
+ * @param string[]|string $paths The PSR-0 base directories
+ *
+ * @return void
*/
public function set($prefix, $paths)
{
@@ -220,10 +294,12 @@ public function set($prefix, $paths)
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param array|string $paths The PSR-4 base directories
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param string[]|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
+ *
+ * @return void
*/
public function setPsr4($prefix, $paths)
{
@@ -243,6 +319,8 @@ public function setPsr4($prefix, $paths)
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
+ *
+ * @return void
*/
public function setUseIncludePath($useIncludePath)
{
@@ -265,6 +343,8 @@ public function getUseIncludePath()
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
+ *
+ * @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
@@ -285,6 +365,8 @@ public function isClassMapAuthoritative()
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
+ *
+ * @return void
*/
public function setApcuPrefix($apcuPrefix)
{
@@ -305,6 +387,8 @@ public function getApcuPrefix()
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
+ *
+ * @return void
*/
public function register($prepend = false)
{
@@ -324,6 +408,8 @@ public function register($prepend = false)
/**
* Unregisters this instance as an autoloader.
+ *
+ * @return void
*/
public function unregister()
{
@@ -343,7 +429,8 @@ public function unregister()
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
- includeFile($file);
+ $includeFile = self::$includeFile;
+ $includeFile($file);
return true;
}
@@ -403,6 +490,11 @@ public static function getRegisteredLoaders()
return self::$registeredLoaders;
}
+ /**
+ * @param string $class
+ * @param string $ext
+ * @return string|false
+ */
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
@@ -468,14 +560,26 @@ private function findFileWithExtension($class, $ext)
return false;
}
-}
-/**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- */
-function includeFile($file)
-{
- include $file;
+ /**
+ * @return void
+ */
+ private static function initializeIncludeClosure()
+ {
+ if (self::$includeFile !== null) {
+ return;
+ }
+
+ /**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ *
+ * @param string $file
+ * @return void
+ */
+ self::$includeFile = \Closure::bind(static function($file) {
+ include $file;
+ }, null, null);
+ }
}
diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php
index b3a4e161..c6b54af7 100644
--- a/vendor/composer/InstalledVersions.php
+++ b/vendor/composer/InstalledVersions.php
@@ -20,12 +20,27 @@
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
- * To require it's presence, you can require `composer-runtime-api ^2.0`
+ * To require its presence, you can require `composer-runtime-api ^2.0`
+ *
+ * @final
*/
class InstalledVersions
{
+ /**
+ * @var mixed[]|null
+ * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null
+ */
private static $installed;
+
+ /**
+ * @var bool|null
+ */
private static $canGetVendors;
+
+ /**
+ * @var array[]
+ * @psalm-var array}>
+ */
private static $installedByVendor = array();
/**
@@ -228,7 +243,7 @@ public static function getInstallPath($packageName)
/**
* @return array
- * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
+ * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
@@ -242,7 +257,7 @@ public static function getRootPackage()
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
- * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array}
+ * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}
*/
public static function getRawData()
{
@@ -265,7 +280,7 @@ public static function getRawData()
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
- * @psalm-return list}>
+ * @psalm-return list}>
*/
public static function getAllRawData()
{
@@ -288,7 +303,7 @@ public static function getAllRawData()
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
- * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array} $data
+ * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data
*/
public static function reload($data)
{
@@ -298,7 +313,7 @@ public static function reload($data)
/**
* @return array[]
- * @psalm-return list}>
+ * @psalm-return list}>
*/
private static function getInstalled()
{
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index b26f1b13..0fb0a2c1 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer
-$vendorDir = dirname(dirname(__FILE__));
+$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php
index b7fc0125..15a2ff3a 100644
--- a/vendor/composer/autoload_namespaces.php
+++ b/vendor/composer/autoload_namespaces.php
@@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer
-$vendorDir = dirname(dirname(__FILE__));
+$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php
index 9d82e6d7..44ef7e3d 100644
--- a/vendor/composer/autoload_psr4.php
+++ b/vendor/composer/autoload_psr4.php
@@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer
-$vendorDir = dirname(dirname(__FILE__));
+$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
index 974e8597..d72a07f0 100644
--- a/vendor/composer/autoload_real.php
+++ b/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInit8dc43cf8fbf0d1c266f8eaa3e064d435
+class ComposerAutoloaderInit6a66df1ef797fcdfb799866defc62aa2
{
private static $loader;
@@ -22,31 +22,12 @@ public static function getLoader()
return self::$loader;
}
- spl_autoload_register(array('ComposerAutoloaderInit8dc43cf8fbf0d1c266f8eaa3e064d435', 'loadClassLoader'), true, true);
- self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
- spl_autoload_unregister(array('ComposerAutoloaderInit8dc43cf8fbf0d1c266f8eaa3e064d435', 'loadClassLoader'));
-
- $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
- if ($useStaticLoader) {
- require __DIR__ . '/autoload_static.php';
-
- call_user_func(\Composer\Autoload\ComposerStaticInit8dc43cf8fbf0d1c266f8eaa3e064d435::getInitializer($loader));
- } else {
- $map = require __DIR__ . '/autoload_namespaces.php';
- foreach ($map as $namespace => $path) {
- $loader->set($namespace, $path);
- }
-
- $map = require __DIR__ . '/autoload_psr4.php';
- foreach ($map as $namespace => $path) {
- $loader->setPsr4($namespace, $path);
- }
-
- $classMap = require __DIR__ . '/autoload_classmap.php';
- if ($classMap) {
- $loader->addClassMap($classMap);
- }
- }
+ spl_autoload_register(array('ComposerAutoloaderInit6a66df1ef797fcdfb799866defc62aa2', 'loadClassLoader'), true, true);
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
+ spl_autoload_unregister(array('ComposerAutoloaderInit6a66df1ef797fcdfb799866defc62aa2', 'loadClassLoader'));
+
+ require __DIR__ . '/autoload_static.php';
+ call_user_func(\Composer\Autoload\ComposerStaticInit6a66df1ef797fcdfb799866defc62aa2::getInitializer($loader));
$loader->register(true);
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 400773a9..5ac56b28 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
namespace Composer\Autoload;
-class ComposerStaticInit8dc43cf8fbf0d1c266f8eaa3e064d435
+class ComposerStaticInit6a66df1ef797fcdfb799866defc62aa2
{
public static $prefixLengthsPsr4 = array (
'S' =>
@@ -37,9 +37,9 @@ class ComposerStaticInit8dc43cf8fbf0d1c266f8eaa3e064d435
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
- $loader->prefixLengthsPsr4 = ComposerStaticInit8dc43cf8fbf0d1c266f8eaa3e064d435::$prefixLengthsPsr4;
- $loader->prefixDirsPsr4 = ComposerStaticInit8dc43cf8fbf0d1c266f8eaa3e064d435::$prefixDirsPsr4;
- $loader->classMap = ComposerStaticInit8dc43cf8fbf0d1c266f8eaa3e064d435::$classMap;
+ $loader->prefixLengthsPsr4 = ComposerStaticInit6a66df1ef797fcdfb799866defc62aa2::$prefixLengthsPsr4;
+ $loader->prefixDirsPsr4 = ComposerStaticInit6a66df1ef797fcdfb799866defc62aa2::$prefixDirsPsr4;
+ $loader->classMap = ComposerStaticInit6a66df1ef797fcdfb799866defc62aa2::$classMap;
}, null, ClassLoader::class);
}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index ede1fb7f..e61cb0da 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -210,17 +210,17 @@
},
{
"name": "stripe/stripe-php",
- "version": "v9.0.0",
- "version_normalized": "9.0.0.0",
+ "version": "v10.6.0-beta.1",
+ "version_normalized": "10.6.0.0-beta1",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
- "reference": "e405c178c2167f568e654296ad6b20eb461761b5"
+ "reference": "40505396844a9c3b7c16c1c3f3b9c1ee84af3fa6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/stripe/stripe-php/zipball/e405c178c2167f568e654296ad6b20eb461761b5",
- "reference": "e405c178c2167f568e654296ad6b20eb461761b5",
+ "url": "https://api.github.com/repos/stripe/stripe-php/zipball/40505396844a9c3b7c16c1c3f3b9c1ee84af3fa6",
+ "reference": "40505396844a9c3b7c16c1c3f3b9c1ee84af3fa6",
"shasum": ""
},
"require": {
@@ -231,11 +231,12 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.5.0",
+ "php-coveralls/php-coveralls": "^2.5",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^5.7 || ^9.0",
"squizlabs/php_codesniffer": "^3.3"
},
- "time": "2022-08-02T15:47:44+00:00",
+ "time": "2023-02-02T23:53:13+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -267,7 +268,7 @@
],
"support": {
"issues": "https://github.com/stripe/stripe-php/issues",
- "source": "https://github.com/stripe/stripe-php/tree/v9.0.0"
+ "source": "https://github.com/stripe/stripe-php/tree/v10.6.0-beta.1"
},
"install-path": "../stripe/stripe-php"
},
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index ff23880e..909fd33e 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -1,31 +1,31 @@
array(
+ 'name' => 'wpsimplepay/wp-simple-pay-pro-3',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
+ 'reference' => '505f5b2367dfb6567e67215f1951ed91122075d6',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
- 'reference' => '4811f01e73be7deccbe61be8fc2fa3691304f994',
- 'name' => 'wpsimplepay/wp-simple-pay-pro-3',
'dev' => false,
),
'versions' => array(
'berlindb/core' => array(
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
+ 'reference' => '7dcddaddcffb69c58800d2fb3f6f169791cab1f7',
'type' => 'library',
'install_path' => __DIR__ . '/../berlindb/core',
'aliases' => array(),
- 'reference' => '7dcddaddcffb69c58800d2fb3f6f169791cab1f7',
'dev_requirement' => false,
),
'container-interop/container-interop' => array(
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
+ 'reference' => '79cbf1341c22ec75643d841642dd5d6acd83bdb8',
'type' => 'library',
'install_path' => __DIR__ . '/../container-interop/container-interop',
'aliases' => array(),
- 'reference' => '79cbf1341c22ec75643d841642dd5d6acd83bdb8',
'dev_requirement' => false,
),
'container-interop/container-interop-implementation' => array(
@@ -37,10 +37,10 @@
'league/container' => array(
'pretty_version' => '2.5.0',
'version' => '2.5.0.0',
+ 'reference' => '8438dc47a0674e3378bcce893a0a04d79a2c22b3',
'type' => 'library',
'install_path' => __DIR__ . '/../league/container',
'aliases' => array(),
- 'reference' => '8438dc47a0674e3378bcce893a0a04d79a2c22b3',
'dev_requirement' => false,
),
'orno/di' => array(
@@ -52,10 +52,10 @@
'psr/container' => array(
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
+ 'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/container',
'aliases' => array(),
- 'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
'dev_requirement' => false,
),
'psr/container-implementation' => array(
@@ -65,30 +65,30 @@
),
),
'stripe/stripe-php' => array(
- 'pretty_version' => 'v9.0.0',
- 'version' => '9.0.0.0',
+ 'pretty_version' => 'v10.6.0-beta.1',
+ 'version' => '10.6.0.0-beta1',
+ 'reference' => '40505396844a9c3b7c16c1c3f3b9c1ee84af3fa6',
'type' => 'library',
'install_path' => __DIR__ . '/../stripe/stripe-php',
'aliases' => array(),
- 'reference' => 'e405c178c2167f568e654296ad6b20eb461761b5',
'dev_requirement' => false,
),
'woocommerce/action-scheduler' => array(
'pretty_version' => '3.4.0',
'version' => '3.4.0.0',
+ 'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
'aliases' => array(),
- 'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
'dev_requirement' => false,
),
'wpsimplepay/wp-simple-pay-pro-3' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
+ 'reference' => '505f5b2367dfb6567e67215f1951ed91122075d6',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
- 'reference' => '4811f01e73be7deccbe61be8fc2fa3691304f994',
'dev_requirement' => false,
),
),
diff --git a/views/admin-education-payment-form-payment-page-settings.php b/views/admin-education-payment-form-payment-page-settings.php
index 00320713..a2f2cba9 100644
--- a/views/admin-education-payment-form-payment-page-settings.php
+++ b/views/admin-education-payment-form-payment-page-settings.php
@@ -10,54 +10,3 @@
*
* @var string $features_url URL to features page on website.
*/
-
-use SimplePay\Core\Utils;
-?>
-
-