charge_automatically, or send_invoice
. 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. Defaults to charge_automatically
.
* @property \Stripe\StripeObject $computed
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
* @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.
* @property (string|\Stripe\TaxRate)[] $default_tax_rates The tax rates applied to this quote.
* @property null|string $description A description that will be displayed on the quote PDF.
* @property (string|\Stripe\Discount)[] $discounts The discounts applied to this quote.
* @property int $expires_at The date on which the quote will be canceled if in open
or draft
status. Measured in seconds since the Unix epoch.
* @property null|string $footer A footer that will be displayed on the quote PDF.
* @property null|\Stripe\StripeObject $from_quote Details of the quote that was cloned. See the cloning documentation for more details.
* @property null|string $header A header that will be displayed on the quote PDF.
* @property null|string|\Stripe\Invoice $invoice The invoice that was created from this quote.
* @property null|\Stripe\StripeObject $invoice_settings All invoices will be billed using the specified settings.
* @property \Stripe\Collection $line_items A list of items the customer is being quoted 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.
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string $number A unique number that identifies this particular quote. This number is assigned once the quote is finalized.
* @property null|string|\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the Connect documentation for details.
* @property string $status The status of the quote.
* @property \Stripe\StripeObject $status_transitions
* @property null|string|\Stripe\Subscription $subscription The subscription that was created or updated from this quote.
* @property \Stripe\StripeObject $subscription_data
* @property null|string|\Stripe\SubscriptionSchedule $subscription_schedule The subscription schedule that was created or updated from this quote.
* @property \Stripe\StripeObject $total_details
* @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.
*/
class Quote extends ApiResource
{
const OBJECT_NAME = 'quote';
use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
use ApiOperations\Update;
const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
const STATUS_ACCEPTED = 'accepted';
const STATUS_CANCELED = 'canceled';
const STATUS_DRAFT = 'draft';
const STATUS_OPEN = 'open';
/**
* @param callable $readBodyChunkCallable
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public function pdf($readBodyChunkCallable, $params = null, $opts = null)
{
$opts = \Stripe\Util\RequestOptions::parse($opts);
if (null === $opts->apiBase) {
$opts->apiBase = Stripe::$apiUploadBase;
}
$url = $this->instanceUrl() . '/pdf';
$this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts);
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote the accepted quote
*/
public function accept($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/accept';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote the canceled quote
*/
public function cancel($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Quote the finalized quote
*/
public function finalizeQuote($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/finalize';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
/**
* @param null|array $params
* @param null|array|string $opts
* @param mixed $id
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection list of LineItems
*/
public static function allComputedUpfrontLineItems($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/computed_upfront_line_items';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
/**
* @param null|array $params
* @param null|array|string $opts
* @param mixed $id
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection list of LineItems
*/
public static function allLineItems($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/line_items';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}