Package com.stripe.model
Class InvoiceItem
java.lang.Object
com.stripe.model.StripeObject
com.stripe.net.ApiResource
com.stripe.model.InvoiceItem
- All Implemented Interfaces:
HasId
,MetadataStore<InvoiceItem>
,StripeActiveObject
,StripeObjectInterface
Invoice Items represent the component lines of an invoice. An invoice item is added to an invoice
by creating or updating it with an
invoice
field, at which point it will be included as
an invoice line item within invoice.lines.
Invoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined with a subscription. Sometimes you want to add a charge or credit to a customer, but actually charge or credit the customer’s card only at the end of a regular billing cycle. This is useful for combining several charges (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals.
Related guides: Integrate with the Invoicing API, Subscription Invoices.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON, INTERNAL_GSON
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
static InvoiceItem
create
(InvoiceItemCreateParams params) Creates an item to be added to a draft invoice (up to 250 items per invoice).static InvoiceItem
create
(InvoiceItemCreateParams params, RequestOptions options) Creates an item to be added to a draft invoice (up to 250 items per invoice).static InvoiceItem
Creates an item to be added to a draft invoice (up to 250 items per invoice).static InvoiceItem
create
(Map<String, Object> params, RequestOptions options) Creates an item to be added to a draft invoice (up to 250 items per invoice).delete()
Deletes an invoice item, removing it from an invoice.delete
(RequestOptions options) Deletes an invoice item, removing it from an invoice.Deletes an invoice item, removing it from an invoice.delete
(Map<String, Object> params, RequestOptions options) Deletes an invoice item, removing it from an invoice.boolean
Amount (in thecurrency
specified) of the invoice item.Three-letter ISO currency code, in lowercase.Get ID of expandablecustomer
object.Get expandedcustomer
.getDate()
Time at which the object was created.Always true for a deleted object.An arbitrary string attached to the object.If true, discounts will apply to this invoice item.Get expandeddiscounts
.Get IDs of expandablediscounts
object list.getId()
Unique identifier for the object.Get ID of expandableinvoice
object.Get expandedinvoice
.Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.Set of key-value pairs that you can attach to an object.String representing the object's type.getPlan()
If the invoice item is a proration, the plan of the subscription that the proration was computed for.getPrice()
The price of the invoice item.Whether the invoice item was created automatically as a proration adjustment when the customer switched plans.Quantity of units for the invoice item.Get ID of expandablesubscription
object.The subscription item that this invoice item has been created for, if any.Get expandedsubscription
.The tax rates which apply to the invoice item.Get ID of expandabletestClock
object.Get expandedtestClock
.Unit amount (in thecurrency
specified) of the invoice item.Same asunit_amount
, but contains a decimal value with at most 12 decimal places.int
hashCode()
static InvoiceItemCollection
list
(InvoiceItemListParams params) Returns a list of your invoice items.static InvoiceItemCollection
list
(InvoiceItemListParams params, RequestOptions options) Returns a list of your invoice items.static InvoiceItemCollection
Returns a list of your invoice items.static InvoiceItemCollection
list
(Map<String, Object> params, RequestOptions options) Returns a list of your invoice items.static InvoiceItem
Retrieves the invoice item with the given ID.static InvoiceItem
retrieve
(String invoiceitem, RequestOptions options) Retrieves the invoice item with the given ID.static InvoiceItem
retrieve
(String invoiceitem, InvoiceItemRetrieveParams params, RequestOptions options) Retrieves the invoice item with the given ID.static InvoiceItem
Retrieves the invoice item with the given ID.void
Amount (in thecurrency
specified) of the invoice item.void
setCurrency
(String currency) Three-letter ISO currency code, in lowercase.void
setCustomer
(String id) void
setCustomerObject
(Customer expandableObject) void
Time at which the object was created.void
setDeleted
(Boolean deleted) Always true for a deleted object.void
setDescription
(String description) An arbitrary string attached to the object.void
setDiscountable
(Boolean discountable) If true, discounts will apply to this invoice item.void
setDiscountObjects
(List<Discount> objs) void
setDiscounts
(List<String> ids) void
Unique identifier for the object.void
setInvoice
(String id) void
setInvoiceObject
(Invoice expandableObject) void
setLivemode
(Boolean livemode) Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
setMetadata
(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.void
String representing the object's type.void
setPeriod
(InvoiceItem.Period period) void
If the invoice item is a proration, the plan of the subscription that the proration was computed for.void
The price of the invoice item.void
setProration
(Boolean proration) Whether the invoice item was created automatically as a proration adjustment when the customer switched plans.void
setQuantity
(Long quantity) Quantity of units for the invoice item.void
setResponseGetter
(StripeResponseGetter responseGetter) Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.void
void
setSubscriptionItem
(String subscriptionItem) The subscription item that this invoice item has been created for, if any.void
setSubscriptionObject
(Subscription expandableObject) void
setTaxRates
(List<TaxRate> taxRates) The tax rates which apply to the invoice item.void
setTestClock
(String id) void
setTestClockObject
(TestClock expandableObject) void
setUnitAmount
(Long unitAmount) Unit amount (in thecurrency
specified) of the invoice item.void
setUnitAmountDecimal
(BigDecimal unitAmountDecimal) Same asunit_amount
, but contains a decimal value with at most 12 decimal places.update
(InvoiceItemUpdateParams params) Updates the amount or description of an invoice item on an upcoming invoice.update
(InvoiceItemUpdateParams params, RequestOptions options) Updates the amount or description of an invoice item on an upcoming invoice.Updates the amount or description of an invoice item on an upcoming invoice.update
(Map<String, Object> params, RequestOptions options) Updates the amount or description of an invoice item on an upcoming invoice.Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setStripeResponseGetter, urlEncode, urlEncodeId
Methods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
InvoiceItem
public InvoiceItem()
-
-
Method Details
-
getCustomer
Get ID of expandablecustomer
object. -
setCustomer
-
getCustomerObject
Get expandedcustomer
. -
setCustomerObject
-
getInvoice
Get ID of expandableinvoice
object. -
setInvoice
-
getInvoiceObject
Get expandedinvoice
. -
setInvoiceObject
-
getSubscription
Get ID of expandablesubscription
object. -
setSubscription
-
getSubscriptionObject
Get expandedsubscription
. -
setSubscriptionObject
-
getTestClock
Get ID of expandabletestClock
object. -
setTestClock
-
getTestClockObject
Get expandedtestClock
. -
setTestClockObject
-
getDiscounts
Get IDs of expandablediscounts
object list. -
setDiscounts
-
getDiscountObjects
Get expandeddiscounts
. -
setDiscountObjects
-
create
Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is specified, the item will be on the next invoice created for the customer specified.- Throws:
StripeException
-
create
public static InvoiceItem create(Map<String, Object> params, RequestOptions options) throws StripeExceptionCreates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is specified, the item will be on the next invoice created for the customer specified.- Throws:
StripeException
-
create
Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is specified, the item will be on the next invoice created for the customer specified.- Throws:
StripeException
-
create
public static InvoiceItem create(InvoiceItemCreateParams params, RequestOptions options) throws StripeException Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is specified, the item will be on the next invoice created for the customer specified.- Throws:
StripeException
-
delete
Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice.- Throws:
StripeException
-
delete
Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice.- Throws:
StripeException
-
delete
Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice.- Throws:
StripeException
-
delete
Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice.- Throws:
StripeException
-
list
Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first.- Throws:
StripeException
-
list
public static InvoiceItemCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionReturns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first.- Throws:
StripeException
-
list
Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first.- Throws:
StripeException
-
list
public static InvoiceItemCollection list(InvoiceItemListParams params, RequestOptions options) throws StripeException Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first.- Throws:
StripeException
-
retrieve
Retrieves the invoice item with the given ID.- Throws:
StripeException
-
retrieve
public static InvoiceItem retrieve(String invoiceitem, RequestOptions options) throws StripeException Retrieves the invoice item with the given ID.- Throws:
StripeException
-
retrieve
public static InvoiceItem retrieve(String invoiceitem, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves the invoice item with the given ID.- Throws:
StripeException
-
retrieve
public static InvoiceItem retrieve(String invoiceitem, InvoiceItemRetrieveParams params, RequestOptions options) throws StripeException Retrieves the invoice item with the given ID.- Throws:
StripeException
-
update
Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the invoice it’s attached to is closed.- Specified by:
update
in interfaceMetadataStore<InvoiceItem>
- Throws:
StripeException
-
update
Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the invoice it’s attached to is closed.- Specified by:
update
in interfaceMetadataStore<InvoiceItem>
- Throws:
StripeException
-
update
Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the invoice it’s attached to is closed.- Throws:
StripeException
-
update
public InvoiceItem update(InvoiceItemUpdateParams params, RequestOptions options) throws StripeException Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the invoice it’s attached to is closed.- Throws:
StripeException
-
setResponseGetter
Description copied from interface:StripeActiveObject
Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.- Specified by:
setResponseGetter
in interfaceStripeActiveObject
- Overrides:
setResponseGetter
in classApiResource
- Parameters:
responseGetter
- theStripeResponseGetter
instance to use for making further requests.
-
getAmount
Amount (in thecurrency
specified) of the invoice item. This should always be equal tounit_amount * quantity
. -
getCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
getDate
Time at which the object was created. Measured in seconds since the Unix epoch. -
getDeleted
Always true for a deleted object. -
getDescription
An arbitrary string attached to the object. Often useful for displaying to users. -
getDiscountable
If true, discounts will apply to this invoice item. Always false for prorations. -
getLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
invoiceitem
. -
getPeriod
-
getPlan
If the invoice item is a proration, the plan of the subscription that the proration was computed for. -
getPrice
The price of the invoice item. -
getProration
Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. -
getQuantity
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. -
getSubscriptionItem
The subscription item that this invoice item has been created for, if any. -
getTaxRates
The tax rates which apply to the invoice item. When set, thedefault_tax_rates
on the invoice do not apply to this invoice item. -
getUnitAmount
Unit amount (in thecurrency
specified) of the invoice item. -
getUnitAmountDecimal
Same asunit_amount
, but contains a decimal value with at most 12 decimal places. -
setAmount
Amount (in thecurrency
specified) of the invoice item. This should always be equal tounit_amount * quantity
. -
setCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
setDate
Time at which the object was created. Measured in seconds since the Unix epoch. -
setDeleted
Always true for a deleted object. -
setDescription
An arbitrary string attached to the object. Often useful for displaying to users. -
setDiscountable
If true, discounts will apply to this invoice item. Always false for prorations. -
setId
Unique identifier for the object. -
setLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
setMetadata
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. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
invoiceitem
. -
setPeriod
-
setPlan
If the invoice item is a proration, the plan of the subscription that the proration was computed for. -
setPrice
The price of the invoice item. -
setProration
Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. -
setQuantity
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. -
setSubscriptionItem
The subscription item that this invoice item has been created for, if any. -
setTaxRates
The tax rates which apply to the invoice item. When set, thedefault_tax_rates
on the invoice do not apply to this invoice item. -
setUnitAmount
Unit amount (in thecurrency
specified) of the invoice item. -
setUnitAmountDecimal
Same asunit_amount
, but contains a decimal value with at most 12 decimal places. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object. -
getMetadata
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.- Specified by:
getMetadata
in interfaceMetadataStore<InvoiceItem>
-