Sample - Stripe API
POST/v1/invoiceitems

Create an invoice item

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.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.
  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

20 body fields
amountintegeroptional
The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. Passing in a negative `amount` will reduce the `amount_due` on the invoice.
currencystringoptional
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
customerstringoptional
The ID of the customer to bill for this invoice item.
customer_accountstringoptional
The ID of the account representing the customer to bill for this invoice item.
descriptionstringoptional
An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
discountablebooleanoptional
Controls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for all other invoice items.
discountsarray<DiscountsDataParam>optional
The coupons and promotion codes to redeem into discounts for the invoice item or invoice line item.
expandarray<string>optional
Specifies which fields in the response should be expanded.
invoicestringoptional
The ID of an existing invoice to add this invoice item to. For subscription invoices, when left blank, the invoice item will be added to the next upcoming scheduled invoice. For standalone invoices, the invoice item won't be automatically added unless you pass `pending_invoice_item_behavior: 'include'` when creating the invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice.
metadataobjectoptional
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
periodobjectoptional
The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://docs.stripe.com/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://docs.stripe.com/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
price_dataobjectoptional
Data used to generate a new [Price](https://docs.stripe.com/api/prices) object inline.
pricingobjectoptional
The pricing information for the invoice item.
quantityintegeroptional
Non-negative integer. The quantity of units for the invoice item. Use `quantity_decimal` instead to provide decimal precision. This field will be deprecated in favor of `quantity_decimal` in a future version.
quantity_decimalstringoptional
Non-negative decimal with at most 12 decimal places. The quantity of units for the invoice item.
subscriptionstringoptional
The ID of a subscription to add this invoice item to. When left blank, the invoice item is added to the next upcoming scheduled invoice. When set, scheduled invoices for subscriptions other than the specified subscription will ignore the invoice item. Use this when you want to express that an invoice item has been accrued within the context of a particular subscription.
tax_behaviorstringoptional
Only required if a [default tax behavior](https://docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
Allowed:exclusiveinclusiveunspecified
tax_codestringoptional
A [tax code](https://docs.stripe.com/tax/tax-categories) ID.
tax_ratesarray<string>optional
The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.
unit_amount_decimalstringoptional
The decimal unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This `unit_amount_decimal` will be multiplied by the quantity to get the full amount. Passing in a negative `unit_amount_decimal` will reduce the `amount_due` on the invoice. Accepts at most 12 decimal places.

2 status codes
200Successful response.
amountintegerrequired
Amount (in the `currency` specified) of the invoice item. This should always be equal to `unit_amount * quantity`.
currencystringrequired
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
customerstringrequired
The ID of the customer to bill for this invoice item.
customer_accountstringoptional
The ID of the account to bill for this invoice item.
dateintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
descriptionstringoptional
An arbitrary string attached to the object. Often useful for displaying to users.
discountablebooleanrequired
If true, discounts will apply to this invoice item. Always false for prorations.
discountsarray<string>optional
The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
frozen_fieldsarray<string>optional
Array of field names that can't be modified. Attempting to update a frozen field returns an error.
idstringrequired
Unique identifier for the object.
invoicestringoptional
The ID of the invoice this invoice item belongs to.
livemodebooleanrequired
If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
metadataobjectoptional
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
net_amountintegeroptional
The amount after discounts, but before credits and taxes. This field is `null` for `discountable=true` items.
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:invoiceitem
parentobjectoptional
The parent that generated this invoice item.
periodobjectrequired
pricingobjectoptional
The pricing information of the invoice item.
prorationbooleanrequired
Whether the invoice item was created automatically as a proration adjustment when the customer switched plans.
proration_detailsobjectoptional
quantityintegerrequired
Quantity of units for the invoice item in integer format, with any decimal precision truncated. For the item's full-precision decimal quantity, use `quantity_decimal`. This field will be deprecated in favor of `quantity_decimal` in a future version. If the invoice item is a proration, the quantity of the subscription that the proration was computed for.
quantity_decimalstringrequired
Non-negative decimal with at most 12 decimal places. The quantity of units for the invoice item.
tax_ratesarray<TaxRate>optional
The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.
test_clockstringoptional
ID of the test clock this invoice item belongs to.
defaultError response.
errorobjectrequired

Error handling

Any other status is an error: Error response.