InvoiceItems
Create, update, delete, and query the available invoice items in Stripe.
Table Specific Information
Select
Server-Side Query Support
The add-in uses the Stripe API to filter the results by the following columns and operators while the rest of the filter is executed client-side within the add-in.
- Id, InvoiceId, Customer, and AccountId support the following operator: =.
- Date supports the following operators: <, >, >=, <, <=, =.
You can select:
An InvoiceItem by specifying its Id:
SELECT * FROM InvoiceItems WHERE Id = 'or_12345678'
InvoiceItems for a given Customer:
SELECT * FROM InvoiceItems WHERE Customer = 'cus_12345678'
InvoiceItems created after a specific date (Date may be used with the >, >=, <, <=, or = conditions and may be used twice to specify a range):
SELECT * FROM InvoiceItems WHERE Date = '2018-11-16 10:59:00.0'
Insert
To create a new InvoiceItem, the Customer, Currency, and Amount fields are required:
INSERT INTO InvoiceItems (Customer, Currency, Amount) VALUES ('cus_NBs3z63zmfCJy1', 'USD', '225')
INSERT can be executed by specifying the DiscountsAggregate column. The columns that are not read-only can be inserted (optional). DiscountsAggregate is an aggregate column.
To insert using this column as Temp table:
INSERT INTO InvoiceItemDiscounts#TEMP (Coupon) VALUES ('Pqx2fHKt'); INSERT INTO InvoiceItems (Customer, Amount, Currency, DiscountsAggregate) VALUES ('cus_O20ZOZfrjjJeGj', 25000, 'USD', 'InvoiceItemDiscounts#TEMP');
To insert using this column as JSON:
INSERT INTO InvoiceItems (Customer, currency, MetadataAggregate, PeriodEnd, PeriodStart, DiscountsAggregate, PriceDataProduct, PriceDataCurrency) Values ('cus_PARXAI77xUsWw1', 'USD' ,'[{\"key\":\"test2\",\"type\":\"text\",\"test\":\"value\"}]', '2023-11-03 14:00:09.000000', '2023-11-03 14:00:08.000000','[{\"discount\":\"text\"},{\"discount\":\"value\"}]', 'product1', 'usd')
INSERT can be executed by specifying the TaxRatesAggregate column. The columns that are not read-only can be inserted (optional):
INSERT INTO InvoiceItems (Customer, Currency, Amount, TaxRatesAggregate) VALUES ('cus_9s6XKzkNRiz8i3', 'USD', 125614, '[\"txr_1OL7oy2eZvKYlo2CLylDtkiI\",\"txr_1OL7oo2eZvKYlo2CHliiOEZT\"]');
Update
To update an InvoiceItem, specify an Id:
UPDATE InvoiceItems SET PeriodStart = '2023-11-03 14:00:06.000000', PeriodEnd = '2023-11-03 14:00:08.000000' WHERE Id = 'ii_1OIS6s2eZvKYlo2COIxLnMms'
Delete
To delete an InvoiceItem, specify an Id:
DELETE from InvoiceItems WHERE Id = 'ii_1OP2II2eZvKYlo2CLc0nHFnR'
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | String | True |
The Id of the invoice item. | |
InvoiceId | String | False |
Invoices.Id |
The Id of the invoice. |
Amount | Int | False |
The amount, in cents. | |
Customer | String | False |
Customers.Id |
The ID of the customer who will be billed when this invoice item is billed. |
Currency | String | False |
Three-letter ISO currency code, in lowercase. Must be a supported currency. | |
Date | Datetime | False |
Time at which the object was created. | |
Description | String | False |
An arbitrary string attached to the object. Often useful for displaying to users. The description field on invoice line items has a maximum character length limit of 500. | |
Discountable | Boolean | False |
If true, discounts will apply to this line item. This is always false for prorations. | |
LiveMode | Boolean | False |
Has the value true if the object exists in live mode or the value false if the object exists in test mode. | |
PeriodStart | Datetime | False |
The start of the period. | |
PeriodEnd | Datetime | False |
The end of the period which must be greater than or equal to the start. | |
PlanId | String | False |
Unique identifier for the plan. | |
PlanAggregate | String | True |
The plan of the subscription, if the line item is a subscription or a proration. | |
PriceId | String | False |
Unique identifier for the price. | |
PriceAggregate | String | True |
The price of the invoice item. | |
Proration | Boolean | True |
Whether this is a proration. | |
Quantity | Int | False |
The quantity of the subscription, if the line item is a subscription or a proration. | |
Subscription | String | False |
The Id of the subscription the item pertains to. | |
SubscriptionItems | String | False |
The subscription item that this invoice item has been created for, if any. | |
TestClock | String | False |
ID of the test clock this invoice item belongs to. | |
UnitAmount | Integer | False |
Unit amount (in the currency specified) of the invoice item. | |
UnitAmountDecimal | Decimal | False |
Decimal value of Unit amount (in the currency specified) of the invoice item. | |
MetadataAggregate | String | False |
The metadata object. | |
DiscountsAggregate | String | False |
The discounts which apply to the invoice item. | |
TaxRatesAggregate | String | False |
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. |
Pseudo-Columns
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.
Name | Type | Description |
PriceDataProduct | String |
The ID of the product that this price will belong to. This is a psuedo-column to support insert operations. |
PriceDataCurrency | String |
Three-letter ISO currency code, in lowercase. Must be a supported currency. This is a psuedo-column to support insert operations. |
PriceDataTaxBehavior | String |
Only required if a default tax behavior 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. This is a psuedo-column to support insert operations. |
PriceDataUnitAmount | Int |
A positive integer in cents (or 0 for a free price) representing how much to charge. This is a psuedo-column to support insert operations. |
PriceDataUnitAmountDecimal | String |
Same as unit_amount, but accepts a decimal value in cents with at most 12 decimal places. Only one of unit_amount and unit_amount_decimal can be set. This is a psuedo-column to support insert operations. |
TaxBehavior | String |
Only required if a default tax behavior 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. This is a psuedo-column to support insert operations. |
TaxCode | String |
A tax code ID. |
AccountId | String |
The Id of the connected account to get invoice line items for. |