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

stripe / stripe-php / #7087

pending completion
#7087

push

php-coveralls

pakrym-stripe
Bump version to 10.14.0-beta.2

1831 of 2732 relevant lines covered (67.02%)

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

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

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

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

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

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

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

102
        return $this;
1✔
103
    }
104

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

119
        return $this;
1✔
120
    }
121

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

136
        return $this;
×
137
    }
138

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

153
        return $this;
1✔
154
    }
155

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

172
        return $obj;
×
173
    }
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 LineItems
183
     */
184
    public static function allLineItems($id, $params = null, $opts = null)
185
    {
186
        $url = static::resourceUrl($id) . '/line_items';
1✔
187
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
1✔
188
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
1✔
189
        $obj->setLastResponse($response);
1✔
190

191
        return $obj;
1✔
192
    }
193

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

210
        return $obj;
×
211
    }
212

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

227
        return $this;
×
228
    }
229

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

247
        return $obj;
×
248
    }
249

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

266
        return $obj;
×
267
    }
268

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

285
        return $obj;
×
286
    }
287

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

302
        return $this;
×
303
    }
304
}
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