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
InvoiceItem.php
144 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * Invoice Items represent the component lines of an <a href="https://stripe.com/docs/api/invoices">invoice</a>. An invoice item is added to an |
| 8 | * invoice by creating or updating it with an <code>invoice</code> field, at which point it will be included as |
| 9 | * <a href="https://stripe.com/docs/api/invoices/line_item">an invoice line item</a> within |
| 10 | * <a href="https://stripe.com/docs/api/invoices/object#invoice_object-lines">invoice.lines</a>. |
| 11 | * |
| 12 | * Invoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined |
| 13 | * with a <a href="https://stripe.com/docs/api/subscriptions">subscription</a>. Sometimes you want to add a charge or credit to a customer, but actually charge |
| 14 | * or credit the customer’s card only at the end of a regular billing cycle. This is useful for combining several charges |
| 15 | * (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals. |
| 16 | * |
| 17 | * Related guides: <a href="https://stripe.com/docs/invoicing/integration">Integrate with the Invoicing API</a>, <a href="https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items">Subscription Invoices</a>. |
| 18 | * |
| 19 | * @property string $id Unique identifier for the object. |
| 20 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 21 | * @property int $amount Amount (in the <code>currency</code> specified) of the invoice item. This should always be equal to <code>unit_amount * quantity</code>. |
| 22 | * @property 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 string|\Stripe\Customer $customer The ID of the customer who will be billed when this invoice item is billed. |
| 24 | * @property int $date Time at which the object was created. Measured in seconds since the Unix epoch. |
| 25 | * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. |
| 26 | * @property bool $discountable If true, discounts will apply to this invoice item. Always false for prorations. |
| 27 | * @property null|(string|\Stripe\Discount)[] $discounts The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use <code>expand[]=discounts</code> to expand each discount. |
| 28 | * @property null|string|\Stripe\Invoice $invoice The ID of the invoice this invoice item belongs to. |
| 29 | * @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. |
| 30 | * @property null|\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. |
| 31 | * @property \Stripe\StripeObject $period |
| 32 | * @property null|\Stripe\Plan $plan If the invoice item is a proration, the plan of the subscription that the proration was computed for. |
| 33 | * @property null|\Stripe\Price $price The price of the invoice item. |
| 34 | * @property bool $proration Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. |
| 35 | * @property int $quantity Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for. |
| 36 | * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice item has been created for, if any. |
| 37 | * @property null|string $subscription_item The subscription item that this invoice item has been created for, if any. |
| 38 | * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the invoice item. When set, the <code>default_tax_rates</code> on the invoice do not apply to this invoice item. |
| 39 | * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this invoice item belongs to. |
| 40 | * @property null|int $unit_amount Unit amount (in the <code>currency</code> specified) of the invoice item. |
| 41 | * @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places. |
| 42 | */ |
| 43 | class InvoiceItem extends ApiResource |
| 44 | { |
| 45 | const OBJECT_NAME = 'invoiceitem'; |
| 46 | use ApiOperations\Update; |
| 47 | /** |
| 48 | * Creates an item to be added to a draft invoice (up to 250 items per invoice). If |
| 49 | * no invoice is specified, the item will be on the next invoice created for the |
| 50 | * customer specified. |
| 51 | * |
| 52 | * @param null|array $params |
| 53 | * @param null|array|string $options |
| 54 | * |
| 55 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 56 | * |
| 57 | * @return \Stripe\InvoiceItem the created resource |
| 58 | */ |
| 59 | public static function create($params = null, $options = null) |
| 60 | { |
| 61 | self::_validateParams($params); |
| 62 | $url = static::classUrl(); |
| 63 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 64 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 65 | $obj->setLastResponse($response); |
| 66 | return $obj; |
| 67 | } |
| 68 | /** |
| 69 | * Deletes an invoice item, removing it from an invoice. Deleting invoice items is |
| 70 | * only possible when they’re not attached to invoices, or if it’s attached to a |
| 71 | * draft invoice. |
| 72 | * |
| 73 | * @param null|array $params |
| 74 | * @param null|array|string $opts |
| 75 | * |
| 76 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 77 | * |
| 78 | * @return \Stripe\InvoiceItem the deleted resource |
| 79 | */ |
| 80 | public function delete($params = null, $opts = null) |
| 81 | { |
| 82 | self::_validateParams($params); |
| 83 | $url = $this->instanceUrl(); |
| 84 | list($response, $opts) = $this->_request('delete', $url, $params, $opts); |
| 85 | $this->refreshFrom($response, $opts); |
| 86 | return $this; |
| 87 | } |
| 88 | /** |
| 89 | * Returns a list of your invoice items. Invoice items are returned sorted by |
| 90 | * creation date, with the most recently created invoice items appearing first. |
| 91 | * |
| 92 | * @param null|array $params |
| 93 | * @param null|array|string $opts |
| 94 | * |
| 95 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 96 | * |
| 97 | * @return \Stripe\Collection<\Stripe\InvoiceItem> of ApiResources |
| 98 | */ |
| 99 | public static function all($params = null, $opts = null) |
| 100 | { |
| 101 | $url = static::classUrl(); |
| 102 | return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts); |
| 103 | } |
| 104 | /** |
| 105 | * Retrieves the invoice item with the given ID. |
| 106 | * |
| 107 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 108 | * @param null|array|string $opts |
| 109 | * |
| 110 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 111 | * |
| 112 | * @return \Stripe\InvoiceItem |
| 113 | */ |
| 114 | public static function retrieve($id, $opts = null) |
| 115 | { |
| 116 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 117 | $instance = new static($id, $opts); |
| 118 | $instance->refresh(); |
| 119 | return $instance; |
| 120 | } |
| 121 | /** |
| 122 | * Updates the amount or description of an invoice item on an upcoming invoice. |
| 123 | * Updating an invoice item is only possible before the invoice it’s attached to is |
| 124 | * closed. |
| 125 | * |
| 126 | * @param string $id the ID of the resource to update |
| 127 | * @param null|array $params |
| 128 | * @param null|array|string $opts |
| 129 | * |
| 130 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 131 | * |
| 132 | * @return \Stripe\InvoiceItem the updated resource |
| 133 | */ |
| 134 | public static function update($id, $params = null, $opts = null) |
| 135 | { |
| 136 | self::_validateParams($params); |
| 137 | $url = static::resourceUrl($id); |
| 138 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 139 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 140 | $obj->setLastResponse($response); |
| 141 | return $obj; |
| 142 | } |
| 143 | } |
| 144 |