ApiOperations
2 months ago
Apps
2 months ago
Billing
2 months ago
BillingPortal
2 months ago
Checkout
2 months ago
Climate
2 months ago
Entitlements
2 months ago
EventData
2 months ago
Events
2 months ago
Exception
2 months ago
FinancialConnections
2 months ago
Forwarding
2 months ago
HttpClient
2 months ago
Identity
2 months ago
Issuing
2 months ago
Radar
2 months ago
Reporting
2 months ago
Service
2 months ago
Sigma
2 months ago
Tax
2 months ago
Terminal
2 months ago
TestHelpers
2 months ago
Treasury
2 months ago
Util
2 months ago
V2
2 months ago
Account.php
2 months ago
AccountLink.php
2 months ago
AccountSession.php
2 months ago
ApiRequestor.php
2 months ago
ApiResource.php
2 months ago
ApiResponse.php
2 months ago
ApplePayDomain.php
2 months ago
Application.php
2 months ago
ApplicationFee.php
2 months ago
ApplicationFeeRefund.php
2 months ago
Balance.php
2 months ago
BalanceTransaction.php
2 months ago
BankAccount.php
2 months ago
BaseStripeClient.php
2 months ago
BaseStripeClientInterface.php
2 months ago
Capability.php
2 months ago
Card.php
2 months ago
CashBalance.php
2 months ago
Charge.php
2 months ago
Collection.php
2 months ago
ConfirmationToken.php
2 months ago
ConnectCollectionTransfer.php
2 months ago
CountrySpec.php
2 months ago
Coupon.php
2 months ago
CreditNote.php
2 months ago
CreditNoteLineItem.php
2 months ago
Customer.php
2 months ago
CustomerBalanceTransaction.php
2 months ago
CustomerCashBalanceTransaction.php
2 months ago
CustomerSession.php
2 months ago
Discount.php
2 months ago
Dispute.php
2 months ago
EphemeralKey.php
2 months ago
ErrorObject.php
2 months ago
Event.php
2 months ago
ExchangeRate.php
2 months ago
File.php
2 months ago
FileLink.php
2 months ago
FundingInstructions.php
2 months ago
Invoice.php
2 months ago
InvoiceItem.php
2 months ago
InvoiceLineItem.php
2 months ago
InvoiceRenderingTemplate.php
2 months ago
LineItem.php
2 months ago
LoginLink.php
2 months ago
Mandate.php
2 months ago
OAuth.php
2 months ago
OAuthErrorObject.php
2 months ago
PaymentIntent.php
2 months ago
PaymentLink.php
2 months ago
PaymentMethod.php
2 months ago
PaymentMethodConfiguration.php
2 months ago
PaymentMethodDomain.php
2 months ago
Payout.php
2 months ago
Person.php
2 months ago
Plan.php
2 months ago
Price.php
2 months ago
Product.php
2 months ago
ProductFeature.php
2 months ago
PromotionCode.php
2 months ago
Quote.php
2 months ago
Reason.php
2 months ago
RecipientTransfer.php
2 months ago
Refund.php
2 months ago
RelatedObject.php
2 months ago
RequestTelemetry.php
2 months ago
ReserveTransaction.php
2 months ago
Review.php
2 months ago
SearchResult.php
2 months ago
SetupAttempt.php
2 months ago
SetupIntent.php
2 months ago
ShippingRate.php
2 months ago
SingletonApiResource.php
2 months ago
Source.php
2 months ago
SourceMandateNotification.php
2 months ago
SourceTransaction.php
2 months ago
Stripe.php
2 months ago
StripeClient.php
2 months ago
StripeClientInterface.php
2 months ago
StripeObject.php
2 months ago
StripeStreamingClientInterface.php
2 months ago
Subscription.php
2 months ago
SubscriptionItem.php
2 months ago
SubscriptionSchedule.php
2 months ago
TaxCode.php
2 months ago
TaxDeductedAtSource.php
2 months ago
TaxId.php
2 months ago
TaxRate.php
2 months ago
ThinEvent.php
2 months ago
Token.php
2 months ago
Topup.php
2 months ago
Transfer.php
2 months ago
TransferReversal.php
2 months ago
UsageRecord.php
2 months ago
UsageRecordSummary.php
2 months ago
Webhook.php
2 months ago
WebhookEndpoint.php
2 months ago
WebhookSignature.php
2 months ago
Quote.php
228 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * A Quote is a way to model prices that you'd like to provide to a customer. |
| 8 | * Once accepted, it will automatically create an invoice, subscription or subscription schedule. |
| 9 | * |
| 10 | * @property string $id Unique identifier for the object. |
| 11 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 12 | * @property int $amount_subtotal Total before any discounts or taxes are applied. |
| 13 | * @property int $amount_total Total after discounts and taxes are applied. |
| 14 | * @property null|string|\Stripe\Application $application ID of the Connect Application that created the quote. |
| 15 | * @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. |
| 16 | * @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. |
| 17 | * @property \Stripe\StripeObject $automatic_tax |
| 18 | * @property string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as <code>active</code>. Defaults to <code>charge_automatically</code>. |
| 19 | * @property \Stripe\StripeObject $computed |
| 20 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 21 | * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. |
| 22 | * @property null|string|\Stripe\Customer $customer The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed. |
| 23 | * @property null|(string|\Stripe\TaxRate)[] $default_tax_rates The tax rates applied to this quote. |
| 24 | * @property null|string $description A description that will be displayed on the quote PDF. |
| 25 | * @property (string|\Stripe\Discount)[] $discounts The discounts applied to this quote. |
| 26 | * @property int $expires_at The date on which the quote will be canceled if in <code>open</code> or <code>draft</code> status. Measured in seconds since the Unix epoch. |
| 27 | * @property null|string $footer A footer that will be displayed on the quote PDF. |
| 28 | * @property null|\Stripe\StripeObject $from_quote Details of the quote that was cloned. See the <a href="https://stripe.com/docs/quotes/clone">cloning documentation</a> for more details. |
| 29 | * @property null|string $header A header that will be displayed on the quote PDF. |
| 30 | * @property null|string|\Stripe\Invoice $invoice The invoice that was created from this quote. |
| 31 | * @property \Stripe\StripeObject $invoice_settings |
| 32 | * @property null|\Stripe\Collection<\Stripe\LineItem> $line_items A list of items the customer is being quoted for. |
| 33 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 34 | * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 35 | * @property null|string $number A unique number that identifies this particular quote. This number is assigned once the quote is <a href="https://stripe.com/docs/quotes/overview#finalize">finalized</a>. |
| 36 | * @property null|string|\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the <a href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect documentation</a> for details. |
| 37 | * @property string $status The status of the quote. |
| 38 | * @property \Stripe\StripeObject $status_transitions |
| 39 | * @property null|string|\Stripe\Subscription $subscription The subscription that was created or updated from this quote. |
| 40 | * @property \Stripe\StripeObject $subscription_data |
| 41 | * @property null|string|\Stripe\SubscriptionSchedule $subscription_schedule The subscription schedule that was created or updated from this quote. |
| 42 | * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this quote belongs to. |
| 43 | * @property \Stripe\StripeObject $total_details |
| 44 | * @property null|\Stripe\StripeObject $transfer_data The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices. |
| 45 | */ |
| 46 | class Quote extends ApiResource |
| 47 | { |
| 48 | const OBJECT_NAME = 'quote'; |
| 49 | use ApiOperations\Update; |
| 50 | const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; |
| 51 | const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; |
| 52 | const STATUS_ACCEPTED = 'accepted'; |
| 53 | const STATUS_CANCELED = 'canceled'; |
| 54 | const STATUS_DRAFT = 'draft'; |
| 55 | const STATUS_OPEN = 'open'; |
| 56 | /** |
| 57 | * A quote models prices and services for a customer. Default options for |
| 58 | * <code>header</code>, <code>description</code>, <code>footer</code>, and |
| 59 | * <code>expires_at</code> can be set in the dashboard via the <a |
| 60 | * href="https://dashboard.stripe.com/settings/billing/quote">quote template</a>. |
| 61 | * |
| 62 | * @param null|array $params |
| 63 | * @param null|array|string $options |
| 64 | * |
| 65 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 66 | * |
| 67 | * @return \Stripe\Quote the created resource |
| 68 | */ |
| 69 | public static function create($params = null, $options = null) |
| 70 | { |
| 71 | self::_validateParams($params); |
| 72 | $url = static::classUrl(); |
| 73 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 74 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 75 | $obj->setLastResponse($response); |
| 76 | return $obj; |
| 77 | } |
| 78 | /** |
| 79 | * Returns a list of your quotes. |
| 80 | * |
| 81 | * @param null|array $params |
| 82 | * @param null|array|string $opts |
| 83 | * |
| 84 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 85 | * |
| 86 | * @return \Stripe\Collection<\Stripe\Quote> of ApiResources |
| 87 | */ |
| 88 | public static function all($params = null, $opts = null) |
| 89 | { |
| 90 | $url = static::classUrl(); |
| 91 | return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts); |
| 92 | } |
| 93 | /** |
| 94 | * Retrieves the quote with the given ID. |
| 95 | * |
| 96 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 97 | * @param null|array|string $opts |
| 98 | * |
| 99 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 100 | * |
| 101 | * @return \Stripe\Quote |
| 102 | */ |
| 103 | public static function retrieve($id, $opts = null) |
| 104 | { |
| 105 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 106 | $instance = new static($id, $opts); |
| 107 | $instance->refresh(); |
| 108 | return $instance; |
| 109 | } |
| 110 | /** |
| 111 | * A quote models prices and services for a customer. |
| 112 | * |
| 113 | * @param string $id the ID of the resource to update |
| 114 | * @param null|array $params |
| 115 | * @param null|array|string $opts |
| 116 | * |
| 117 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 118 | * |
| 119 | * @return \Stripe\Quote the updated resource |
| 120 | */ |
| 121 | public static function update($id, $params = null, $opts = null) |
| 122 | { |
| 123 | self::_validateParams($params); |
| 124 | $url = static::resourceUrl($id); |
| 125 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 126 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 127 | $obj->setLastResponse($response); |
| 128 | return $obj; |
| 129 | } |
| 130 | /** |
| 131 | * @param null|array $params |
| 132 | * @param null|array|string $opts |
| 133 | * |
| 134 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 135 | * |
| 136 | * @return \Stripe\Quote the accepted quote |
| 137 | */ |
| 138 | public function accept($params = null, $opts = null) |
| 139 | { |
| 140 | $url = $this->instanceUrl() . '/accept'; |
| 141 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 142 | $this->refreshFrom($response, $opts); |
| 143 | return $this; |
| 144 | } |
| 145 | /** |
| 146 | * @param null|array $params |
| 147 | * @param null|array|string $opts |
| 148 | * |
| 149 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 150 | * |
| 151 | * @return \Stripe\Quote the canceled quote |
| 152 | */ |
| 153 | public function cancel($params = null, $opts = null) |
| 154 | { |
| 155 | $url = $this->instanceUrl() . '/cancel'; |
| 156 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 157 | $this->refreshFrom($response, $opts); |
| 158 | return $this; |
| 159 | } |
| 160 | /** |
| 161 | * @param null|array $params |
| 162 | * @param null|array|string $opts |
| 163 | * |
| 164 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 165 | * |
| 166 | * @return \Stripe\Quote the finalized quote |
| 167 | */ |
| 168 | public function finalizeQuote($params = null, $opts = null) |
| 169 | { |
| 170 | $url = $this->instanceUrl() . '/finalize'; |
| 171 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 172 | $this->refreshFrom($response, $opts); |
| 173 | return $this; |
| 174 | } |
| 175 | /** |
| 176 | * @param string $id |
| 177 | * @param null|array $params |
| 178 | * @param null|array|string $opts |
| 179 | * |
| 180 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 181 | * |
| 182 | * @return \Stripe\Collection<\Stripe\LineItem> list of line items |
| 183 | */ |
| 184 | public static function allComputedUpfrontLineItems($id, $params = null, $opts = null) |
| 185 | { |
| 186 | $url = static::resourceUrl($id) . '/computed_upfront_line_items'; |
| 187 | list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); |
| 188 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 189 | $obj->setLastResponse($response); |
| 190 | return $obj; |
| 191 | } |
| 192 | /** |
| 193 | * @param string $id |
| 194 | * @param null|array $params |
| 195 | * @param null|array|string $opts |
| 196 | * |
| 197 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 198 | * |
| 199 | * @return \Stripe\Collection<\Stripe\LineItem> list of line items |
| 200 | */ |
| 201 | public static function allLineItems($id, $params = null, $opts = null) |
| 202 | { |
| 203 | $url = static::resourceUrl($id) . '/line_items'; |
| 204 | list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); |
| 205 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 206 | $obj->setLastResponse($response); |
| 207 | return $obj; |
| 208 | } |
| 209 | /** |
| 210 | * @param callable $readBodyChunkCallable |
| 211 | * @param null|array $params |
| 212 | * @param null|array|string $opts |
| 213 | * |
| 214 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 215 | * |
| 216 | * @return void |
| 217 | */ |
| 218 | public function pdf($readBodyChunkCallable, $params = null, $opts = null) |
| 219 | { |
| 220 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 221 | if (!isset($opts->apiBase)) { |
| 222 | $opts->apiBase = \ProfilePressVendor\Stripe\Stripe::$apiUploadBase; |
| 223 | } |
| 224 | $url = $this->instanceUrl() . '/pdf'; |
| 225 | $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts); |
| 226 | } |
| 227 | } |
| 228 |