diff --git a/CHANGELOG.md b/CHANGELOG.md index 6039ae480..cfdbc8213 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 13.12.0 - 2024-02-22 +* [#1651](https://github.com/stripe/stripe-php/pull/1651) Update generated code + * Add support for `client_reference_id` on `Identity.VerificationReport` and `Identity.VerificationSession` + * Remove support for value `service_tax` from enum `TaxRate.tax_type` +* [#1650](https://github.com/stripe/stripe-php/pull/1650) Add TaxIds API + * Add support for `all`, `create`, `delete`, and `retrieve` methods on resource `TaxId` + * The `instanceUrl` function on `TaxId` now returns the top-level `/v1/tax_ids/{id}` path instead of the `/v1/customers/{customer}/tax_ids/{id}` path. + ## 13.12.0-beta.1 - 2024-02-16 * [#1643](https://github.com/stripe/stripe-php/pull/1643) Update generated code for beta * Add support for `decrement_authorization` method on resource `PaymentIntent` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index ca9946295..e3b365910 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v831 \ No newline at end of file +v840 \ No newline at end of file diff --git a/init.php b/init.php index 9c29f941b..0e778c899 100644 --- a/init.php +++ b/init.php @@ -87,6 +87,7 @@ require __DIR__ . '/lib/AccountNotice.php'; require __DIR__ . '/lib/AccountSession.php'; require __DIR__ . '/lib/ApplePayDomain.php'; +require __DIR__ . '/lib/Application.php'; require __DIR__ . '/lib/ApplicationFee.php'; require __DIR__ . '/lib/ApplicationFeeRefund.php'; require __DIR__ . '/lib/Apps/Secret.php'; @@ -107,6 +108,7 @@ require __DIR__ . '/lib/Climate/Product.php'; require __DIR__ . '/lib/Climate/Supplier.php'; require __DIR__ . '/lib/ConfirmationToken.php'; +require __DIR__ . '/lib/ConnectCollectionTransfer.php'; require __DIR__ . '/lib/CountrySpec.php'; require __DIR__ . '/lib/Coupon.php'; require __DIR__ . '/lib/CreditNote.php'; @@ -114,6 +116,8 @@ require __DIR__ . '/lib/Customer.php'; require __DIR__ . '/lib/CustomerBalanceTransaction.php'; require __DIR__ . '/lib/CustomerCashBalanceTransaction.php'; +require __DIR__ . '/lib/CustomerEntitlement.php'; +require __DIR__ . '/lib/CustomerEntitlementSummary.php'; require __DIR__ . '/lib/CustomerSession.php'; require __DIR__ . '/lib/Discount.php'; require __DIR__ . '/lib/Dispute.php'; @@ -125,6 +129,7 @@ require __DIR__ . '/lib/File.php'; require __DIR__ . '/lib/FileLink.php'; require __DIR__ . '/lib/FinancialConnections/Account.php'; +require __DIR__ . '/lib/FinancialConnections/AccountInferredBalance.php'; require __DIR__ . '/lib/FinancialConnections/AccountOwner.php'; require __DIR__ . '/lib/FinancialConnections/AccountOwnership.php'; require __DIR__ . '/lib/FinancialConnections/Session.php'; @@ -137,6 +142,7 @@ require __DIR__ . '/lib/Invoice.php'; require __DIR__ . '/lib/InvoiceItem.php'; require __DIR__ . '/lib/InvoiceLineItem.php'; +require __DIR__ . '/lib/InvoicePayment.php'; require __DIR__ . '/lib/Issuing/Authorization.php'; require __DIR__ . '/lib/Issuing/Card.php'; require __DIR__ . '/lib/Issuing/Cardholder.php'; @@ -159,18 +165,22 @@ require __DIR__ . '/lib/Payout.php'; require __DIR__ . '/lib/Person.php'; require __DIR__ . '/lib/Plan.php'; +require __DIR__ . '/lib/PlatformTaxFee.php'; require __DIR__ . '/lib/Price.php'; require __DIR__ . '/lib/Product.php'; require __DIR__ . '/lib/PromotionCode.php'; require __DIR__ . '/lib/Quote.php'; require __DIR__ . '/lib/QuoteLine.php'; require __DIR__ . '/lib/QuotePhase.php'; +require __DIR__ . '/lib/QuotePreviewInvoice.php'; +require __DIR__ . '/lib/QuotePreviewSubscriptionSchedule.php'; require __DIR__ . '/lib/Radar/EarlyFraudWarning.php'; require __DIR__ . '/lib/Radar/ValueList.php'; require __DIR__ . '/lib/Radar/ValueListItem.php'; require __DIR__ . '/lib/Refund.php'; require __DIR__ . '/lib/Reporting/ReportRun.php'; require __DIR__ . '/lib/Reporting/ReportType.php'; +require __DIR__ . '/lib/ReserveTransaction.php'; require __DIR__ . '/lib/Review.php'; require __DIR__ . '/lib/Service/AccountLinkService.php'; require __DIR__ . '/lib/Service/AccountNoticeService.php'; @@ -274,6 +284,7 @@ require __DIR__ . '/lib/Service/Tax/TaxServiceFactory.php'; require __DIR__ . '/lib/Service/Tax/TransactionService.php'; require __DIR__ . '/lib/Service/TaxCodeService.php'; +require __DIR__ . '/lib/Service/TaxIdService.php'; require __DIR__ . '/lib/Service/TaxRateService.php'; require __DIR__ . '/lib/Service/Terminal/ConfigurationService.php'; require __DIR__ . '/lib/Service/Terminal/ConnectionTokenService.php'; @@ -317,6 +328,7 @@ require __DIR__ . '/lib/ShippingRate.php'; require __DIR__ . '/lib/Sigma/ScheduledQueryRun.php'; require __DIR__ . '/lib/Source.php'; +require __DIR__ . '/lib/SourceMandateNotification.php'; require __DIR__ . '/lib/SourceTransaction.php'; require __DIR__ . '/lib/Subscription.php'; require __DIR__ . '/lib/SubscriptionItem.php'; @@ -329,6 +341,7 @@ require __DIR__ . '/lib/Tax/Transaction.php'; require __DIR__ . '/lib/Tax/TransactionLineItem.php'; require __DIR__ . '/lib/TaxCode.php'; +require __DIR__ . '/lib/TaxDeductedAtSource.php'; require __DIR__ . '/lib/TaxId.php'; require __DIR__ . '/lib/TaxRate.php'; require __DIR__ . '/lib/Terminal/Configuration.php'; diff --git a/lib/Application.php b/lib/Application.php new file mode 100644 index 000000000..e74ef025b --- /dev/null +++ b/lib/Application.php @@ -0,0 +1,15 @@ +amount - fee * @property string $reporting_category Learn more about how reporting categories can help you understand balance transactions from an accounting perspective. - * @property null|string|\Stripe\ApplicationFee|\Stripe\ApplicationFeeRefund|\Stripe\Charge|\Stripe\CustomerCashBalanceTransaction|\Stripe\Dispute|\Stripe\Issuing\Authorization|\Stripe\Issuing\Dispute|\Stripe\Issuing\Transaction|\Stripe\Payout|\Stripe\Refund|\Stripe\StripeObject|\Stripe\Topup|\Stripe\Transfer|\Stripe\TransferReversal $source This transaction relates to the Stripe object. + * @property null|string|\Stripe\ApplicationFee|\Stripe\ApplicationFeeRefund|\Stripe\Charge|\Stripe\ConnectCollectionTransfer|\Stripe\CustomerCashBalanceTransaction|\Stripe\Dispute|\Stripe\Issuing\Authorization|\Stripe\Issuing\Dispute|\Stripe\Issuing\Transaction|\Stripe\Payout|\Stripe\PlatformTaxFee|\Stripe\Refund|\Stripe\ReserveTransaction|\Stripe\TaxDeductedAtSource|\Stripe\Topup|\Stripe\Transfer|\Stripe\TransferReversal $source This transaction relates to the Stripe object. * @property string $status The transaction's net funds status in the Stripe balance, which are either available or pending. * @property string $type Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, climate_order_purchase, climate_order_refund, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_outbound, obligation_reversal_inbound, payment, payment_failure_refund, payment_network_reserve_hold, payment_network_reserve_release, payment_refund, payment_reversal, payment_unreconciled, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead. */ diff --git a/lib/BillingPortal/Configuration.php b/lib/BillingPortal/Configuration.php index e9c4488f9..bc730eb9b 100644 --- a/lib/BillingPortal/Configuration.php +++ b/lib/BillingPortal/Configuration.php @@ -10,7 +10,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 bool $active Whether the configuration is active and can be used to create portal sessions. - * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the configuration. + * @property null|string|\Stripe\Application $application ID of the Connect Application that created the configuration. * @property \Stripe\StripeObject $business_profile * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $default_return_url The default URL to redirect customers to when they click on the portal's link to return to your website. This can be overriden when creating the session. diff --git a/lib/Charge.php b/lib/Charge.php index 000a159d6..2d5f0a608 100644 --- a/lib/Charge.php +++ b/lib/Charge.php @@ -15,7 +15,7 @@ * @property int $amount Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). * @property int $amount_captured Amount in cents (or local equivalent) captured (can be less than the amount attribute on the charge if a partial capture was made). * @property int $amount_refunded Amount in cents (or local equivalent) refunded (can be less than the amount attribute on the charge if a partial refund was issued). - * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the charge. + * @property null|string|\Stripe\Application $application ID of the Connect application that created the charge. * @property null|string|\Stripe\ApplicationFee $application_fee The application fee (if any) for the charge. See the Connect documentation for details. * @property null|int $application_fee_amount The amount of the application fee (if any) requested for the charge. See the Connect documentation for details. * @property null|string $authorization_code Authorization code on the charge. diff --git a/lib/ConnectCollectionTransfer.php b/lib/ConnectCollectionTransfer.php new file mode 100644 index 000000000..69f961d0a --- /dev/null +++ b/lib/ConnectCollectionTransfer.php @@ -0,0 +1,18 @@ +ISO currency code, in lowercase. Must be a supported currency. + * @property string|\Stripe\Account $destination ID of the account that funds are being collected for. + * @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 ConnectCollectionTransfer extends ApiResource +{ + const OBJECT_NAME = 'connect_collection_transfer'; +} diff --git a/lib/CustomerEntitlement.php b/lib/CustomerEntitlement.php new file mode 100644 index 000000000..61061d461 --- /dev/null +++ b/lib/CustomerEntitlement.php @@ -0,0 +1,24 @@ +true if the object exists in live mode or the value false if the object exists in test mode. + * @property string $lookup_key A unique key you provide as your own system identifier. This may be up to 80 characters. + * @property null|\Stripe\StripeObject $quantity Contains information about entitlements relating to features with type=quantity. Required when the feature has type=quantity. + * @property string $type The type of feature. + */ +class CustomerEntitlement extends ApiResource +{ + const OBJECT_NAME = 'customer_entitlement'; + + const TYPE_QUANTITY = 'quantity'; + const TYPE_SWITCH = 'switch'; +} diff --git a/lib/CustomerEntitlementSummary.php b/lib/CustomerEntitlementSummary.php new file mode 100644 index 000000000..aca562bff --- /dev/null +++ b/lib/CustomerEntitlementSummary.php @@ -0,0 +1,18 @@ + $entitlements The list of entitlements this customer has. + * @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 CustomerEntitlementSummary extends ApiResource +{ + const OBJECT_NAME = 'customer_entitlement_summary'; +} diff --git a/lib/FinancialConnections/AccountInferredBalance.php b/lib/FinancialConnections/AccountInferredBalance.php new file mode 100644 index 000000000..20d4fd2e4 --- /dev/null +++ b/lib/FinancialConnections/AccountInferredBalance.php @@ -0,0 +1,18 @@ +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 AccountInferredBalance extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'financial_connections.account_inferred_balance'; +} diff --git a/lib/Identity/VerificationReport.php b/lib/Identity/VerificationReport.php index 424e2d2db..2b23299b7 100644 --- a/lib/Identity/VerificationReport.php +++ b/lib/Identity/VerificationReport.php @@ -19,6 +19,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 null|string $client_reference_id A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|\Stripe\StripeObject $document Result from a document check * @property null|\Stripe\StripeObject $id_number Result from an id_number check diff --git a/lib/Identity/VerificationSession.php b/lib/Identity/VerificationSession.php index f1102ad5a..2539c27ad 100644 --- a/lib/Identity/VerificationSession.php +++ b/lib/Identity/VerificationSession.php @@ -19,6 +19,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 null|string $client_reference_id A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. * @property null|string $client_secret The short-lived client secret used by Stripe.js to show a verification modal inside your app. This client secret expires after 24 hours and can only be used once. Don’t store it, log it, embed it in a URL, or expose it to anyone other than the user. Make sure that you have TLS enabled on any page that includes the client secret. Refer to our docs on passing the client secret to the frontend to learn more. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|\Stripe\StripeObject $last_error If present, this property tells you the last error encountered when processing the verification. diff --git a/lib/Invoice.php b/lib/Invoice.php index 808bda1db..d02ce29fc 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -48,7 +48,7 @@ * @property int $amount_remaining The difference between amount_due and amount_paid, in cents (or local equivalent). * @property int $amount_shipping This is the sum of all the shipping amounts. * @property null|\Stripe\StripeObject[] $amounts_due List of expected payments and corresponding due dates. This value will be null for invoices where collection_method=charge_automatically. - * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the invoice. + * @property null|string|\Stripe\Application $application ID of the Connect Application that created the invoice. * @property null|int $application_fee_amount The fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. * @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users. @@ -95,7 +95,7 @@ * @property bool $paid_out_of_band Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe. * @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. * @property \Stripe\StripeObject $payment_settings - * @property null|\Stripe\Collection<\Stripe\StripeObject> $payments Payments for this invoice + * @property null|\Stripe\Collection<\Stripe\InvoicePayment> $payments Payments for this invoice * @property int $period_end End of the usage period during which invoice items were added to this invoice. * @property int $period_start Start of the usage period during which invoice items were added to this invoice. * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice. diff --git a/lib/InvoiceLineItem.php b/lib/InvoiceLineItem.php index e9886bece..cdc661e8c 100644 --- a/lib/InvoiceLineItem.php +++ b/lib/InvoiceLineItem.php @@ -36,4 +36,6 @@ class InvoiceLineItem extends ApiResource { const OBJECT_NAME = 'line_item'; + + use ApiOperations\Update; } diff --git a/lib/InvoicePayment.php b/lib/InvoicePayment.php new file mode 100644 index 000000000..bee30277b --- /dev/null +++ b/lib/InvoicePayment.php @@ -0,0 +1,28 @@ +invoice_credit_balance. This field is null until the payment is paid. Overpayment can happen when you attach more than one PaymentIntent to the invoice, and each of them succeeds. To avoid overpayment, cancel any PaymentIntents that you do not need before attaching more. + * @property null|int $amount_paid Amount that was actually paid for this invoice, in cents (or local equivalent). This field is null until the payment is paid. This amount can be less than the amount_requested if the PaymentIntent’s amount_received is not sufficient to pay all of the invoices that it is attached to. + * @property int $amount_requested Amount intended to be paid toward this invoice, in cents (or local equivalent) + * @property null|string|\Stripe\Charge $charge ID of the successful charge for this payment. This field is null when the payment is open or canceled. + * @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|\Stripe\Invoice $invoice The invoice that was paid. + * @property null|bool $is_default Stripe automatically creates a default InvoicePayment when the invoice is finalized, and keeps it synchronized with the invoice’s amount_remaining. The PaymentIntent associated with the default payment can’t be edited or canceled directly. + * @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|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent associated with this payment. Note: This property is only populated for invoices finalized on or after March 15th, 2019. + * @property string $status The status of the payment, one of open, paid, or canceled. + * @property \Stripe\StripeObject $status_transitions + */ +class InvoicePayment extends ApiResource +{ + const OBJECT_NAME = 'invoice_payment'; +} diff --git a/lib/Order.php b/lib/Order.php index b991cdef7..12aa35596 100644 --- a/lib/Order.php +++ b/lib/Order.php @@ -16,7 +16,7 @@ * @property null|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|\Stripe\StripeObject $application ID of the Connect application that created the Order, if any. + * @property null|string|\Stripe\Application $application ID of the Connect application that created the Order, if any. * @property null|\Stripe\StripeObject $automatic_tax * @property null|\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.

diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index 4e6104632..acb88b4b5 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -23,7 +23,7 @@ * @property int $amount_capturable Amount that can be captured from this PaymentIntent. * @property null|\Stripe\StripeObject $amount_details * @property int $amount_received Amount that this PaymentIntent collects. - * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the PaymentIntent. + * @property null|string|\Stripe\Application $application ID of the Connect application that created the PaymentIntent. * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents use case for connected accounts. * @property null|\Stripe\StripeObject $automatic_payment_methods Settings to configure compatible payment methods from the Stripe Dashboard * @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. diff --git a/lib/PaymentLink.php b/lib/PaymentLink.php index 89763d69d..13d1ab992 100644 --- a/lib/PaymentLink.php +++ b/lib/PaymentLink.php @@ -16,7 +16,7 @@ * @property bool $active Whether the payment link's url is active. If false, customers visiting the URL will be shown a page saying that the link has been deactivated. * @property \Stripe\StripeObject $after_completion * @property bool $allow_promotion_codes Whether user redeemable promotion codes are enabled. - * @property null|string|\Stripe\StripeObject $application The ID of the Connect application that created the Payment Link. + * @property null|string|\Stripe\Application $application The ID of the Connect application that created the Payment Link. * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. * @property null|float $application_fee_percent This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. * @property \Stripe\StripeObject $automatic_tax diff --git a/lib/PlatformTaxFee.php b/lib/PlatformTaxFee.php new file mode 100644 index 000000000..cb9fea7db --- /dev/null +++ b/lib/PlatformTaxFee.php @@ -0,0 +1,17 @@ +starts_at in the past if collection is paused between starts_at and now. * @property int $amount_subtotal Total before any discounts or taxes are applied. * @property int $amount_total Total after discounts and taxes are applied. - * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the quote. + * @property null|string|\Stripe\Application $application ID of the Connect Application that created the quote. * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote. * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote. * @property \Stripe\StripeObject $automatic_tax diff --git a/lib/QuotePreviewInvoice.php b/lib/QuotePreviewInvoice.php new file mode 100644 index 000000000..2aa9441f7 --- /dev/null +++ b/lib/QuotePreviewInvoice.php @@ -0,0 +1,151 @@ +invoice items, and proration adjustments + * that may be caused by subscription upgrades/downgrades (if necessary). + * + * If your invoice is configured to be billed through automatic charges, + * Stripe automatically finalizes your invoice and attempts payment. Note + * that finalizing the invoice, + * when automatic, does + * not happen immediately as the invoice is created. Stripe waits + * until one hour after the last webhook was successfully sent (or the last + * webhook timed out after failing). If you (and the platforms you may have + * connected to) have no webhooks configured, Stripe waits one hour after + * creation to finalize the invoice. + * + * If your invoice is configured to be billed by sending an email, then based on your + * email settings, + * Stripe will email the invoice to your customer and await payment. These + * emails can contain a link to a hosted page to pay the invoice. + * + * Stripe applies any customer credit on the account before determining the + * amount due for the invoice (i.e., the amount that will be actually + * charged). If the amount due for the invoice is less than Stripe's minimum allowed charge + * per currency, the + * invoice is automatically marked paid, and we add the amount due to the + * customer's credit balance which is applied to the next invoice. + * + * More details on the customer's credit balance are + * here. + * + * Related guide: Send invoices to customers + * + * @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. + * @property null|(string|\Stripe\TaxId)[] $account_tax_ids The account tax IDs associated with the invoice. Only editable when the invoice is a draft. + * @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the 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 cents (or local equivalent), that was paid. + * @property int $amount_remaining The difference between amount_due and amount_paid, in cents (or local equivalent). + * @property int $amount_shipping This is the sum of all the shipping amounts. + * @property null|\Stripe\StripeObject[] $amounts_due List of expected payments and corresponding due dates. This value will be null for invoices where collection_method=charge_automatically. + * @property null|string|\Stripe\Application $application ID of the Connect Application that created the invoice. + * @property null|int $application_fee_amount The fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. + * @property \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 \Stripe\StripeObject $automatic_tax + * @property null|string $billing_reason

Indicates the reason why the invoice was created.

* manual: Unrelated to a subscription, for example, created via the invoice editor. * subscription: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds. * subscription_create: A new subscription was created. * subscription_cycle: A subscription advanced into a new period. * subscription_threshold: A subscription reached a billing threshold. * subscription_update: A subscription was updated. * upcoming: Reserved for simulated invoices, per the upcoming invoice endpoint.

+ * @property string $collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|\Stripe\StripeObject[] $custom_fields Custom fields displayed on the invoice. + * @property null|\Stripe\StripeObject $customer_address The customer's address. Until the invoice is finalized, this field will equal customer.address. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_email The customer's email. Until the invoice is finalized, this field will equal customer.email. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_name The customer's name. Until the invoice is finalized, this field will equal customer.name. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_phone The customer's phone number. Until the invoice is finalized, this field will equal customer.phone. Once the invoice is finalized, this field will no longer be updated. + * @property null|\Stripe\StripeObject $customer_shipping The customer's shipping information. Until the invoice is finalized, this field will equal customer.shipping. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_tax_exempt The customer's tax exempt status. Until the invoice is finalized, this field will equal customer.tax_exempt. Once the invoice is finalized, this field will no longer be updated. + * @property null|\Stripe\StripeObject[] $customer_tax_ids The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as customer.tax_ids. Once the invoice is finalized, this field will no longer be updated. + * @property null|(string|\Stripe\Margin)[] $default_margins The margins applied to the invoice. Can be overridden by line item margins. Use expand[]=default_margins to expand each margin. + * @property null|string|\Stripe\PaymentMethod $default_payment_method ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. + * @property null|string|\Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source $default_source ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. + * @property \Stripe\TaxRate[] $default_tax_rates The tax rates applied to this invoice, if any. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard. + * @property null|\Stripe\Discount $discount Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts. + * @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount. + * @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 $effective_at The date when this invoice is in effect. Same as finalized_at unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt. + * @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|\Stripe\StripeObject $from_invoice Details of the invoice that was cloned. See the revision documentation for more details. + * @property \Stripe\StripeObject $issuer + * @property null|\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|\Stripe\Invoice $latest_revision The ID of the most recent non-draft revision of this invoice + * @property \Stripe\Collection<\Stripe\InvoiceLineItem> $lines The individual line items that make up the invoice. lines is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order. + * @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|\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_payment_attempt The time at which payment will next be attempted. This value will be null for invoices where collection_method=send_invoice. + * @property null|string $number A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified. + * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the Invoices with Connect documentation for details. + * @property bool $paid Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance. + * @property bool $paid_out_of_band Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe. + * @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. + * @property \Stripe\StripeObject $payment_settings + * @property null|\Stripe\Collection<\Stripe\InvoicePayment> $payments Payments for this invoice + * @property int $period_end End of the usage period during which invoice items were added to this invoice. + * @property int $period_start Start of the usage period during which invoice items were added to this invoice. + * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice. + * @property int $pre_payment_credit_notes_amount Total amount of all pre-payment credit notes issued for this invoice. + * @property null|string|\Stripe\Quote $quote The quote this invoice was generated from. + * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this invoice. + * @property null|\Stripe\StripeObject $rendering The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. + * @property null|\Stripe\StripeObject $rendering_options This is a legacy field that will be removed soon. For details about rendering_options, refer to rendering instead. Options for invoice PDF rendering. + * @property null|\Stripe\StripeObject $shipping_cost The details of the cost of shipping, including the ShippingRate applied on the invoice. + * @property null|\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 \Stripe\StripeObject $status_transitions + * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice was prepared for, if any. + * @property null|\Stripe\StripeObject $subscription_details Details about the subscription that created this invoice. + * @property null|int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations. + * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated + * @property null|int $subtotal_excluding_tax The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated + * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. + * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this invoice belongs to. + * @property null|\Stripe\StripeObject $threshold_reason + * @property int $total Total after discounts and taxes. + * @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items. + * @property null|int $total_excluding_tax The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax. + * @property null|\Stripe\StripeObject[] $total_margin_amounts The aggregate amounts calculated per margin across all line items. + * @property \Stripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items. + * @property null|\Stripe\StripeObject $transfer_data The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice. + * @property null|int $webhooks_delivered_at Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have been exhausted. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created. + */ +class QuotePreviewInvoice extends ApiResource +{ + const OBJECT_NAME = 'quote_preview_invoice'; + + const BILLING_REASON_AUTOMATIC_PENDING_INVOICE_ITEM_INVOICE = 'automatic_pending_invoice_item_invoice'; + const BILLING_REASON_MANUAL = 'manual'; + const BILLING_REASON_QUOTE_ACCEPT = 'quote_accept'; + const BILLING_REASON_SUBSCRIPTION = 'subscription'; + const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create'; + const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle'; + const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold'; + const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update'; + const BILLING_REASON_UPCOMING = 'upcoming'; + + const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; + const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; + + const CUSTOMER_TAX_EXEMPT_EXEMPT = 'exempt'; + const CUSTOMER_TAX_EXEMPT_NONE = 'none'; + const CUSTOMER_TAX_EXEMPT_REVERSE = 'reverse'; + + const STATUS_DRAFT = 'draft'; + const STATUS_OPEN = 'open'; + const STATUS_PAID = 'paid'; + const STATUS_UNCOLLECTIBLE = 'uncollectible'; + const STATUS_VOID = 'void'; +} diff --git a/lib/QuotePreviewSubscriptionSchedule.php b/lib/QuotePreviewSubscriptionSchedule.php new file mode 100644 index 000000000..2490e31c5 --- /dev/null +++ b/lib/QuotePreviewSubscriptionSchedule.php @@ -0,0 +1,47 @@ +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|\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|\Stripe\Customer $customer ID of the customer who owns the subscription schedule. + * @property \Stripe\StripeObject $default_settings + * @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|\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 \Stripe\StripeObject[] $phases Configuration for the subscription schedule's phases. + * @property null|\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. + * @property null|string|\Stripe\Subscription $subscription ID of the subscription managed by the subscription schedule. + * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this subscription schedule belongs to. + */ +class QuotePreviewSubscriptionSchedule extends ApiResource +{ + const OBJECT_NAME = 'quote_preview_subscription_schedule'; + + const BILLING_BEHAVIOR_PRORATE_ON_NEXT_PHASE = 'prorate_on_next_phase'; + const BILLING_BEHAVIOR_PRORATE_UP_FRONT = 'prorate_up_front'; + + const END_BEHAVIOR_CANCEL = 'cancel'; + const END_BEHAVIOR_NONE = 'none'; + const END_BEHAVIOR_RELEASE = 'release'; + const END_BEHAVIOR_RENEW = 'renew'; + + const STATUS_ACTIVE = 'active'; + const STATUS_CANCELED = 'canceled'; + const STATUS_COMPLETED = 'completed'; + const STATUS_NOT_STARTED = 'not_started'; + const STATUS_RELEASED = 'released'; +} diff --git a/lib/ReserveTransaction.php b/lib/ReserveTransaction.php new file mode 100644 index 000000000..b78370340 --- /dev/null +++ b/lib/ReserveTransaction.php @@ -0,0 +1,17 @@ +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. + */ +class ReserveTransaction extends ApiResource +{ + const OBJECT_NAME = 'reserve_transaction'; +} diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index 1d1413477..f08bdd568 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -69,6 +69,7 @@ * @property SubscriptionScheduleService $subscriptionSchedules * @property Tax\TaxServiceFactory $tax * @property TaxCodeService $taxCodes + * @property TaxIdService $taxIds * @property TaxRateService $taxRates * @property Terminal\TerminalServiceFactory $terminal * @property TestHelpers\TestHelpersServiceFactory $testHelpers @@ -149,6 +150,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'subscriptionSchedules' => SubscriptionScheduleService::class, 'tax' => Tax\TaxServiceFactory::class, 'taxCodes' => TaxCodeService::class, + 'taxIds' => TaxIdService::class, 'taxRates' => TaxRateService::class, 'terminal' => Terminal\TerminalServiceFactory::class, 'testHelpers' => TestHelpers\TestHelpersServiceFactory::class, diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index 3d0f0911c..f6ae17d7f 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -71,7 +71,7 @@ public function allCashBalanceTransactions($parentId, $params = null, $opts = nu * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\StripeObject> + * @return \Stripe\Collection<\Stripe\CustomerEntitlement> */ public function allEntitlements($parentId, $params = null, $opts = null) { @@ -360,7 +360,7 @@ public function retrieveCashBalanceTransaction($parentId, $id, $params = null, $ * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\StripeObject + * @return \Stripe\CustomerEntitlementSummary */ public function retrieveEntitlementSummary($parentId, $params = null, $opts = null) { diff --git a/lib/Service/FinancialConnections/AccountService.php b/lib/Service/FinancialConnections/AccountService.php index eb4ce0e26..4bfa75911 100644 --- a/lib/Service/FinancialConnections/AccountService.php +++ b/lib/Service/FinancialConnections/AccountService.php @@ -37,7 +37,7 @@ public function all($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\StripeObject> + * @return \Stripe\Collection<\Stripe\FinancialConnections\AccountInferredBalance> */ public function allInferredBalances($parentId, $params = null, $opts = null) { diff --git a/lib/Service/InvoiceService.php b/lib/Service/InvoiceService.php index 46581252f..92e8942c3 100644 --- a/lib/Service/InvoiceService.php +++ b/lib/Service/InvoiceService.php @@ -59,7 +59,7 @@ public function allLines($parentId, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\StripeObject> + * @return \Stripe\Collection<\Stripe\InvoicePayment> */ public function allPayments($parentId, $params = null, $opts = null) { @@ -245,7 +245,7 @@ public function retrieve($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\StripeObject + * @return \Stripe\InvoicePayment */ public function retrievePayment($parentId, $id, $params = null, $opts = null) { @@ -371,6 +371,28 @@ public function update($id, $params = null, $opts = null) return $this->request('post', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); } + /** + * Updates an invoice’s line item. Some fields, such as tax_amounts, + * only live on the invoice line item, so they can only be updated through this + * endpoint. Other fields, such as amount, live on both the invoice + * item and the invoice line item, so updates on this endpoint will propagate to + * the invoice item as well. Updating an invoice’s line item is only possible + * before the invoice is finalized. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceLineItem + */ + public function updateLine($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s/lines/%s', $parentId, $id), $params, $opts); + } + /** * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is * similar to deletion, however it only applies to diff --git a/lib/Service/QuoteService.php b/lib/Service/QuoteService.php index 39a5d163d..513477a3f 100644 --- a/lib/Service/QuoteService.php +++ b/lib/Service/QuoteService.php @@ -124,7 +124,7 @@ public function allPreviewInvoiceLines($parentId, $id, $params = null, $opts = n * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\StripeObject> + * @return \Stripe\Collection<\Stripe\QuotePreviewInvoice> */ public function allPreviewInvoices($parentId, $params = null, $opts = null) { @@ -140,7 +140,7 @@ public function allPreviewInvoices($parentId, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\StripeObject> + * @return \Stripe\Collection<\Stripe\QuotePreviewSubscriptionSchedule> */ public function allPreviewSubscriptionSchedules($parentId, $params = null, $opts = null) { diff --git a/lib/Service/TaxIdService.php b/lib/Service/TaxIdService.php new file mode 100644 index 000000000..a12644fe1 --- /dev/null +++ b/lib/Service/TaxIdService.php @@ -0,0 +1,76 @@ + + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/tax_ids', $params, $opts); + } + + /** + * Creates a new account or customer tax_id object. + * + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/tax_ids', $params, $opts); + } + + /** + * Deletes an existing account or customer tax_id object. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/tax_ids/%s', $id), $params, $opts); + } + + /** + * Retrieves an account or customer tax_id object. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/tax_ids/%s', $id), $params, $opts); + } +} diff --git a/lib/SetupAttempt.php b/lib/SetupAttempt.php index 5c20047be..e755171dc 100644 --- a/lib/SetupAttempt.php +++ b/lib/SetupAttempt.php @@ -12,7 +12,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 null|string|\Stripe\StripeObject $application The value of application on the SetupIntent at the time of this confirmation. + * @property null|string|\Stripe\Application $application The value of application on the SetupIntent at the time of this confirmation. * @property null|bool $attach_to_self

If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.

It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.

* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\Stripe\Customer $customer The value of customer on the SetupIntent at the time of this confirmation. diff --git a/lib/SetupIntent.php b/lib/SetupIntent.php index 5bcfa9827..a9762bbe7 100644 --- a/lib/SetupIntent.php +++ b/lib/SetupIntent.php @@ -29,7 +29,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 null|string|\Stripe\StripeObject $application ID of the Connect application that created the SetupIntent. + * @property null|string|\Stripe\Application $application ID of the Connect application that created the SetupIntent. * @property null|bool $attach_to_self

If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.

It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.

* @property null|\Stripe\StripeObject $automatic_payment_methods Settings for dynamic payment methods compatible with this Setup Intent * @property null|string $cancellation_reason Reason for cancellation of this SetupIntent, one of abandoned, requested_by_customer, or duplicate. diff --git a/lib/SourceMandateNotification.php b/lib/SourceMandateNotification.php new file mode 100644 index 000000000..11960527a --- /dev/null +++ b/lib/SourceMandateNotification.php @@ -0,0 +1,28 @@ +debit_initiated. + * @property null|\Stripe\StripeObject $bacs_debit + * @property int $created Time at which the object was created. 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 string $reason The reason of the mandate notification. Valid reasons are mandate_confirmed or debit_initiated. + * @property null|\Stripe\StripeObject $sepa_debit + * @property \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 Stripe API just like a Card object: once chargeable, they can be charged, or can be attached to customers.

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.

+ * @property string $status The status of the mandate notification. Valid statuses are pending or submitted. + * @property string $type The type of source this mandate notification is attached to. Should be the source type identifier code for the payment method, such as three_d_secure. + */ +class SourceMandateNotification extends ApiResource +{ + const OBJECT_NAME = 'source_mandate_notification'; +} diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 4411bffcd..40afd305b 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -69,6 +69,7 @@ * @property \Stripe\Service\SubscriptionScheduleService $subscriptionSchedules * @property \Stripe\Service\Tax\TaxServiceFactory $tax * @property \Stripe\Service\TaxCodeService $taxCodes + * @property \Stripe\Service\TaxIdService $taxIds * @property \Stripe\Service\TaxRateService $taxRates * @property \Stripe\Service\Terminal\TerminalServiceFactory $terminal * @property \Stripe\Service\TestHelpers\TestHelpersServiceFactory $testHelpers diff --git a/lib/Subscription.php b/lib/Subscription.php index 8571322bb..18593c40b 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -11,7 +11,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 null|string|\Stripe\StripeObject $application ID of the Connect Application that created the subscription. + * @property null|string|\Stripe\Application $application ID of the Connect Application that created the subscription. * @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 total that will be transferred to the application owner's Stripe account. * @property \Stripe\StripeObject $automatic_tax * @property int $billing_cycle_anchor The reference point that aligns future billing cycle dates. It sets the day of week for week intervals, the day of month for month and year intervals, and the month of year for year intervals. The timestamp is in UTC format. diff --git a/lib/SubscriptionSchedule.php b/lib/SubscriptionSchedule.php index 0ac4c1622..15573387a 100644 --- a/lib/SubscriptionSchedule.php +++ b/lib/SubscriptionSchedule.php @@ -11,7 +11,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 null|string|\Stripe\StripeObject $application ID of the Connect Application that created the schedule. + * @property null|string|\Stripe\Application $application ID of the Connect Application that created the schedule. * @property null|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. diff --git a/lib/TaxDeductedAtSource.php b/lib/TaxDeductedAtSource.php new file mode 100644 index 000000000..93bb8a341 --- /dev/null +++ b/lib/TaxDeductedAtSource.php @@ -0,0 +1,17 @@ + \Stripe\AccountNotice::class, \Stripe\AccountSession::OBJECT_NAME => \Stripe\AccountSession::class, \Stripe\ApplePayDomain::OBJECT_NAME => \Stripe\ApplePayDomain::class, + \Stripe\Application::OBJECT_NAME => \Stripe\Application::class, \Stripe\ApplicationFee::OBJECT_NAME => \Stripe\ApplicationFee::class, \Stripe\ApplicationFeeRefund::OBJECT_NAME => \Stripe\ApplicationFeeRefund::class, \Stripe\Apps\Secret::OBJECT_NAME => \Stripe\Apps\Secret::class, @@ -39,6 +40,7 @@ class ObjectTypes \Stripe\Climate\Product::OBJECT_NAME => \Stripe\Climate\Product::class, \Stripe\Climate\Supplier::OBJECT_NAME => \Stripe\Climate\Supplier::class, \Stripe\ConfirmationToken::OBJECT_NAME => \Stripe\ConfirmationToken::class, + \Stripe\ConnectCollectionTransfer::OBJECT_NAME => \Stripe\ConnectCollectionTransfer::class, \Stripe\CountrySpec::OBJECT_NAME => \Stripe\CountrySpec::class, \Stripe\Coupon::OBJECT_NAME => \Stripe\Coupon::class, \Stripe\CreditNote::OBJECT_NAME => \Stripe\CreditNote::class, @@ -46,6 +48,8 @@ class ObjectTypes \Stripe\Customer::OBJECT_NAME => \Stripe\Customer::class, \Stripe\CustomerBalanceTransaction::OBJECT_NAME => \Stripe\CustomerBalanceTransaction::class, \Stripe\CustomerCashBalanceTransaction::OBJECT_NAME => \Stripe\CustomerCashBalanceTransaction::class, + \Stripe\CustomerEntitlement::OBJECT_NAME => \Stripe\CustomerEntitlement::class, + \Stripe\CustomerEntitlementSummary::OBJECT_NAME => \Stripe\CustomerEntitlementSummary::class, \Stripe\CustomerSession::OBJECT_NAME => \Stripe\CustomerSession::class, \Stripe\Discount::OBJECT_NAME => \Stripe\Discount::class, \Stripe\Dispute::OBJECT_NAME => \Stripe\Dispute::class, @@ -57,6 +61,7 @@ class ObjectTypes \Stripe\File::OBJECT_NAME => \Stripe\File::class, \Stripe\FileLink::OBJECT_NAME => \Stripe\FileLink::class, \Stripe\FinancialConnections\Account::OBJECT_NAME => \Stripe\FinancialConnections\Account::class, + \Stripe\FinancialConnections\AccountInferredBalance::OBJECT_NAME => \Stripe\FinancialConnections\AccountInferredBalance::class, \Stripe\FinancialConnections\AccountOwner::OBJECT_NAME => \Stripe\FinancialConnections\AccountOwner::class, \Stripe\FinancialConnections\AccountOwnership::OBJECT_NAME => \Stripe\FinancialConnections\AccountOwnership::class, \Stripe\FinancialConnections\Session::OBJECT_NAME => \Stripe\FinancialConnections\Session::class, @@ -69,6 +74,7 @@ class ObjectTypes \Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class, \Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class, \Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class, + \Stripe\InvoicePayment::OBJECT_NAME => \Stripe\InvoicePayment::class, \Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class, \Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class, \Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class, @@ -91,24 +97,29 @@ class ObjectTypes \Stripe\Payout::OBJECT_NAME => \Stripe\Payout::class, \Stripe\Person::OBJECT_NAME => \Stripe\Person::class, \Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class, + \Stripe\PlatformTaxFee::OBJECT_NAME => \Stripe\PlatformTaxFee::class, \Stripe\Price::OBJECT_NAME => \Stripe\Price::class, \Stripe\Product::OBJECT_NAME => \Stripe\Product::class, \Stripe\PromotionCode::OBJECT_NAME => \Stripe\PromotionCode::class, \Stripe\Quote::OBJECT_NAME => \Stripe\Quote::class, \Stripe\QuoteLine::OBJECT_NAME => \Stripe\QuoteLine::class, \Stripe\QuotePhase::OBJECT_NAME => \Stripe\QuotePhase::class, + \Stripe\QuotePreviewInvoice::OBJECT_NAME => \Stripe\QuotePreviewInvoice::class, + \Stripe\QuotePreviewSubscriptionSchedule::OBJECT_NAME => \Stripe\QuotePreviewSubscriptionSchedule::class, \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class, \Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class, \Stripe\Radar\ValueListItem::OBJECT_NAME => \Stripe\Radar\ValueListItem::class, \Stripe\Refund::OBJECT_NAME => \Stripe\Refund::class, \Stripe\Reporting\ReportRun::OBJECT_NAME => \Stripe\Reporting\ReportRun::class, \Stripe\Reporting\ReportType::OBJECT_NAME => \Stripe\Reporting\ReportType::class, + \Stripe\ReserveTransaction::OBJECT_NAME => \Stripe\ReserveTransaction::class, \Stripe\Review::OBJECT_NAME => \Stripe\Review::class, \Stripe\SetupAttempt::OBJECT_NAME => \Stripe\SetupAttempt::class, \Stripe\SetupIntent::OBJECT_NAME => \Stripe\SetupIntent::class, \Stripe\ShippingRate::OBJECT_NAME => \Stripe\ShippingRate::class, \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \Stripe\Sigma\ScheduledQueryRun::class, \Stripe\Source::OBJECT_NAME => \Stripe\Source::class, + \Stripe\SourceMandateNotification::OBJECT_NAME => \Stripe\SourceMandateNotification::class, \Stripe\SourceTransaction::OBJECT_NAME => \Stripe\SourceTransaction::class, \Stripe\Subscription::OBJECT_NAME => \Stripe\Subscription::class, \Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class, @@ -121,6 +132,7 @@ class ObjectTypes \Stripe\Tax\Transaction::OBJECT_NAME => \Stripe\Tax\Transaction::class, \Stripe\Tax\TransactionLineItem::OBJECT_NAME => \Stripe\Tax\TransactionLineItem::class, \Stripe\TaxCode::OBJECT_NAME => \Stripe\TaxCode::class, + \Stripe\TaxDeductedAtSource::OBJECT_NAME => \Stripe\TaxDeductedAtSource::class, \Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class, \Stripe\TaxRate::OBJECT_NAME => \Stripe\TaxRate::class, \Stripe\Terminal\Configuration::OBJECT_NAME => \Stripe\Terminal\Configuration::class, diff --git a/tests/Stripe/TaxIdTest.php b/tests/Stripe/TaxIdTest.php index c08586305..8b9c87161 100644 --- a/tests/Stripe/TaxIdTest.php +++ b/tests/Stripe/TaxIdTest.php @@ -10,24 +10,49 @@ final class TaxIdTest extends \Stripe\TestCase { use TestHelper; - const TEST_CUSTOMER_ID = 'cus_123'; const TEST_RESOURCE_ID = 'txi_123'; - public function testHasCorrectUrl() + public function testIsListable() { - $resource = \Stripe\Customer::retrieveTaxId(self::TEST_CUSTOMER_ID, self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'get', + '/v1/tax_ids' + ); + $resources = TaxId::all(); + static::compatAssertIsArray($resources->data); + static::assertInstanceOf(\Stripe\TaxId::class, $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/tax_ids/' . self::TEST_RESOURCE_ID + ); + $resource = \Stripe\TaxId::retrieve(self::TEST_RESOURCE_ID); + static::assertInstanceOf(\Stripe\TaxId::class, $resource); static::assertSame( - '/v1/customers/' . self::TEST_CUSTOMER_ID . '/tax_ids/' . self::TEST_RESOURCE_ID, + '/v1/tax_ids/' . self::TEST_RESOURCE_ID, $resource->instanceUrl() ); } + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/tax_ids' + ); + $resource = TaxId::create(['type' => 'eu_vat', 'value' => 'DE123456789']); + static::assertInstanceOf(\Stripe\TaxId::class, $resource); + } + public function testIsDeletable() { - $resource = \Stripe\Customer::retrieveTaxId(self::TEST_CUSTOMER_ID, self::TEST_RESOURCE_ID); + $resource = \Stripe\TaxId::retrieve(self::TEST_RESOURCE_ID); $this->expectsRequest( 'delete', - '/v1/customers/' . self::TEST_CUSTOMER_ID . '/tax_ids/' . self::TEST_RESOURCE_ID + '/v1/tax_ids/' . self::TEST_RESOURCE_ID ); $resource->delete(); static::assertInstanceOf(\Stripe\TaxId::class, $resource);