• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-php / #7055

pending completion
#7055

push

php-coveralls

anniel-stripe
Bump version to 10.14.0-beta.1

1802 of 2678 relevant lines covered (67.29%)

3.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.29
/lib/Quote.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe;
6

7
/**
8
 * A Quote is a way to model prices that you'd like to provide to a customer. Once
9
 * accepted, it will automatically create an invoice, subscription or subscription
10
 * schedule.
11
 *
12
 * @property string $id Unique identifier for the object.
13
 * @property string $object String representing the object's type. Objects of the same type share the same value.
14
 * @property int $amount_subtotal Total before any discounts or taxes are applied.
15
 * @property int $amount_total Total after discounts and taxes are applied.
16
 * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the quote.
17
 * @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.
18
 * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote.
19
 * @property \Stripe\StripeObject $automatic_tax
20
 * @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>.
21
 * @property \Stripe\StripeObject $computed
22
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
23
 * @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>.
24
 * @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.
25
 * @property null|(string|\Stripe\TaxRate)[] $default_tax_rates The tax rates applied to this quote.
26
 * @property null|string $description A description that will be displayed on the quote PDF.
27
 * @property (string|\Stripe\Discount)[] $discounts The discounts applied to this quote.
28
 * @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.
29
 * @property null|string $footer A footer that will be displayed on the quote PDF.
30
 * @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.
31
 * @property null|string $header A header that will be displayed on the quote PDF.
32
 * @property null|string|\Stripe\Invoice $invoice The invoice that was created from this quote.
33
 * @property null|\Stripe\StripeObject $invoice_settings All invoices will be billed using the specified settings.
34
 * @property null|\Stripe\Collection<\Stripe\LineItem> $line_items A list of items the customer is being quoted for.
35
 * @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.
36
 * @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.
37
 * @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.
38
 * @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>.
39
 * @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.
40
 * @property string $status The status of the quote.
41
 * @property null|\Stripe\StripeObject $status_details Details on when and why a quote has been marked as stale or canceled.
42
 * @property \Stripe\StripeObject $status_transitions
43
 * @property null|string|\Stripe\Subscription $subscription The subscription that was created or updated from this quote.
44
 * @property \Stripe\StripeObject $subscription_data
45
 * @property null|\Stripe\StripeObject[] $subscription_data_overrides
46
 * @property null|string|\Stripe\SubscriptionSchedule $subscription_schedule The subscription schedule that was created or updated from this quote.
47
 * @property null|\Stripe\StripeObject[] $subscription_schedules The subscription schedules that were created or updated from this quote.
48
 * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this quote belongs to.
49
 * @property \Stripe\StripeObject $total_details
50
 * @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.
51
 */
52
class Quote extends ApiResource
53
{
54
    const OBJECT_NAME = 'quote';
55

56
    use ApiOperations\All;
57
    use ApiOperations\Create;
58
    use ApiOperations\Retrieve;
59
    use ApiOperations\Update;
60

61
    const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
62
    const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
63

64
    const STATUS_ACCEPTED = 'accepted';
65
    const STATUS_ACCEPTING = 'accepting';
66
    const STATUS_CANCELED = 'canceled';
67
    const STATUS_DRAFT = 'draft';
68
    const STATUS_OPEN = 'open';
69
    const STATUS_STALE = 'stale';
70

71
    /**
72
     * @param callable $readBodyChunkCallable
73
     * @param null|array $params
74
     * @param null|array|string $opts
75
     *
76
     * @throws \Stripe\Exception\ApiErrorException if the request fails
77
     */
78
    public function pdf($readBodyChunkCallable, $params = null, $opts = null)
79
    {
80
        $opts = \Stripe\Util\RequestOptions::parse($opts);
1✔
81
        if (null === $opts->apiBase) {
1✔
82
            $opts->apiBase = Stripe::$apiUploadBase;
1✔
83
        }
84

85
        $url = $this->instanceUrl() . '/pdf';
1✔
86
        $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts);
1✔
87
    }
88

89
    /**
90
     * @param null|array $params
91
     * @param null|array|string $opts
92
     *
93
     * @throws \Stripe\Exception\ApiErrorException if the request fails
94
     *
95
     * @return \Stripe\Quote the accepted quote
96
     */
97
    public function accept($params = null, $opts = null)
98
    {
99
        $url = $this->instanceUrl() . '/accept';
1✔
100
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
1✔
101
        $this->refreshFrom($response, $opts);
1✔
102

103
        return $this;
1✔
104
    }
105

106
    /**
107
     * @param null|array $params
108
     * @param null|array|string $opts
109
     *
110
     * @throws \Stripe\Exception\ApiErrorException if the request fails
111
     *
112
     * @return \Stripe\Quote the canceled quote
113
     */
114
    public function cancel($params = null, $opts = null)
115
    {
116
        $url = $this->instanceUrl() . '/cancel';
1✔
117
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
1✔
118
        $this->refreshFrom($response, $opts);
1✔
119

120
        return $this;
1✔
121
    }
122

123
    /**
124
     * @param null|array $params
125
     * @param null|array|string $opts
126
     *
127
     * @throws \Stripe\Exception\ApiErrorException if the request fails
128
     *
129
     * @return \Stripe\Quote the drafted quote
130
     */
131
    public function draftQuote($params = null, $opts = null)
132
    {
133
        $url = $this->instanceUrl() . '/mark_draft';
×
134
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
×
135
        $this->refreshFrom($response, $opts);
×
136

137
        return $this;
×
138
    }
139

140
    /**
141
     * @param null|array $params
142
     * @param null|array|string $opts
143
     *
144
     * @throws \Stripe\Exception\ApiErrorException if the request fails
145
     *
146
     * @return \Stripe\Quote the finalized quote
147
     */
148
    public function finalizeQuote($params = null, $opts = null)
149
    {
150
        $url = $this->instanceUrl() . '/finalize';
1✔
151
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
1✔
152
        $this->refreshFrom($response, $opts);
1✔
153

154
        return $this;
1✔
155
    }
156

157
    /**
158
     * @param string $id
159
     * @param null|array $params
160
     * @param null|array|string $opts
161
     *
162
     * @throws \Stripe\Exception\ApiErrorException if the request fails
163
     *
164
     * @return \Stripe\Collection<\Stripe\LineItem> list of LineItems
165
     */
166
    public static function allComputedUpfrontLineItems($id, $params = null, $opts = null)
167
    {
168
        $url = static::resourceUrl($id) . '/computed_upfront_line_items';
×
169
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
170
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
171
        $obj->setLastResponse($response);
×
172

173
        return $obj;
×
174
    }
175

176
    /**
177
     * @param string $id
178
     * @param null|array $params
179
     * @param null|array|string $opts
180
     *
181
     * @throws \Stripe\Exception\ApiErrorException if the request fails
182
     *
183
     * @return \Stripe\Collection<\Stripe\LineItem> list of LineItems
184
     */
185
    public static function allLineItems($id, $params = null, $opts = null)
186
    {
187
        $url = static::resourceUrl($id) . '/line_items';
1✔
188
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
1✔
189
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
1✔
190
        $obj->setLastResponse($response);
1✔
191

192
        return $obj;
1✔
193
    }
194

195
    /**
196
     * @param string $id
197
     * @param null|array $params
198
     * @param null|array|string $opts
199
     *
200
     * @throws \Stripe\Exception\ApiErrorException if the request fails
201
     *
202
     * @return \Stripe\Collection<\Stripe\QuoteLine> list of QuoteLines
203
     */
204
    public static function allLines($id, $params = null, $opts = null)
205
    {
206
        $url = static::resourceUrl($id) . '/lines';
×
207
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
208
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
209
        $obj->setLastResponse($response);
×
210

211
        return $obj;
×
212
    }
213

214
    /**
215
     * @param null|array $params
216
     * @param null|array|string $opts
217
     *
218
     * @throws \Stripe\Exception\ApiErrorException if the request fails
219
     *
220
     * @return \Stripe\Quote the marked quote
221
     */
222
    public function markStaleQuote($params = null, $opts = null)
223
    {
224
        $url = $this->instanceUrl() . '/mark_stale';
×
225
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
×
226
        $this->refreshFrom($response, $opts);
×
227

228
        return $this;
×
229
    }
230

231
    /**
232
     * @param string $id
233
     * @param string $preview_invoice
234
     * @param null|array $params
235
     * @param null|array|string $opts
236
     *
237
     * @throws \Stripe\Exception\ApiErrorException if the request fails
238
     *
239
     * @return \Stripe\Collection<\Stripe\InvoiceLineItem> list of InvoiceLineItems
240
     */
241
    public static function previewInvoiceLines($id, $preview_invoice, $params = null, $opts = null)
242
    {
243
        $url = static::resourceUrl($id) . '/preview_invoices/' . $preview_invoice . '/lines';
×
244
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
245
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
246
        $obj->setLastResponse($response);
×
247

248
        return $obj;
×
249
    }
250

251
    /**
252
     * @param string $id
253
     * @param null|array $params
254
     * @param null|array|string $opts
255
     *
256
     * @throws \Stripe\Exception\ApiErrorException if the request fails
257
     *
258
     * @return \Stripe\Collection<\Stripe\Invoice> list of Invoices
259
     */
260
    public static function previewInvoices($id, $params = null, $opts = null)
261
    {
262
        $url = static::resourceUrl($id) . '/preview_invoices';
×
263
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
264
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
265
        $obj->setLastResponse($response);
×
266

267
        return $obj;
×
268
    }
269

270
    /**
271
     * @param string $id
272
     * @param null|array $params
273
     * @param null|array|string $opts
274
     *
275
     * @throws \Stripe\Exception\ApiErrorException if the request fails
276
     *
277
     * @return \Stripe\Collection<\Stripe\SubscriptionSchedule> list of SubscriptionSchedules
278
     */
279
    public static function previewSubscriptionSchedules($id, $params = null, $opts = null)
280
    {
281
        $url = static::resourceUrl($id) . '/preview_subscription_schedules';
×
282
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
283
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
284
        $obj->setLastResponse($response);
×
285

286
        return $obj;
×
287
    }
288

289
    /**
290
     * @param null|array $params
291
     * @param null|array|string $opts
292
     *
293
     * @throws \Stripe\Exception\ApiErrorException if the request fails
294
     *
295
     * @return \Stripe\Quote the reestimated quote
296
     */
297
    public function reestimate($params = null, $opts = null)
298
    {
299
        $url = $this->instanceUrl() . '/reestimate';
×
300
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
×
301
        $this->refreshFrom($response, $opts);
×
302

303
        return $this;
×
304
    }
305
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc