Subscriptions
The upcoming_invoice object
A preview of a subscription's next invoice, returned by GET /subscriptions/{id}/upcoming_invoice. Nothing is saved: for a provider-billed subscription the provider's own preview is returned, otherwise Paycose estimates the invoice from the subscription's current lines.
Attributes
objectstringRequiredString naming the object's type,
upcoming_invoice.sourcestringRequiredWhere the preview's amounts come from.
providerThe provider that bills the subscription returned the preview.
estimatedPaycose estimated the preview from the subscription. Usage-based lines are priced at the usage recorded so far, without tax.
currencystringRequiredThree-letter ISO 4217 currency code, in lowercase.
scaling_factorintegerRequiredNumber of smallest currency units in one unit of
currency(10 to the power of the currency's decimal places), e.g.100for THB. Divide an amount by it to get the value in major units.subtotalintegerRequiredSum of the lines' amounts before discount and tax, in the smallest currency unit.
taxintegerRequiredTotal tax on the lines, in the smallest currency unit. Inclusive tax is counted here but is already part of the line amounts.
amount_discountintegerRequiredTotal discount on the lines, in the smallest currency unit.
totalintegerRequiredAmount the next invoice is expected to charge, in the smallest currency unit (for example,
49900is 499.00 THB).period_starttimestampRequiredNullableStart of the period the preview is based on, in Unix seconds: the subscription's current period for an estimate, or the first line's period for a provider preview.
period_endtimestampRequiredNullableEnd of the period the preview is based on, in Unix seconds. Null when the provider's preview gives no period.
next_payment_attimestampRequiredNullableWhen the next invoice is expected, in Unix seconds: the end of the trial while trialing, otherwise the end of the current period.
line_itemsarray of objectsRequiredThe lines the next invoice is expected to contain. An estimate lists the subscription's lines, a repeat of the recurring lines for each earlier period not billed yet, then pending one-time items and pending prorations.
Show child attributes
line_items.product_idstringID of the product billed. Absent on fee lines and on lines of a
providerpreview.line_items.product_price_idstringID of the price billed. On a
providerpreview this is the provider's own price ID. Absent when the line has no price.line_items.product_namestringName of the product, or the item's description on a pending one-time item or proration. Absent on lines of a
providerpreview.line_items.descriptionstringText describing the line. Absent when there is none.
line_items.typestringKind of line. Absent on lines of a
providerpreview.productA recurring line of the subscription.
feeA fee line of the subscription.
onetimeA one-time item from
add_invoice_itemsthat has not been billed yet.prorationA proration from a line item change that has not been billed yet.
line_items.unit_amountintegerRequiredPrice of one unit, in the smallest currency unit.
line_items.quantityintegerRequiredNumber of units. On a usage-based line of an estimate, the usage recorded so far in the current period.
line_items.amount_subtotalintegerRequiredAmount of the line before discount and tax, in the smallest currency unit.
line_items.amount_discountintegerRequiredDiscount on the line, in the smallest currency unit.
line_items.amount_taxintegerRequiredTax on the line, in the smallest currency unit. Inclusive tax is counted here but is already part of
amount_subtotal.line_items.amount_totalintegerRequiredAmount of the line after discount, with exclusive tax added, in the smallest currency unit (for example,
49900is 499.00 THB).line_items.currencystringThree-letter ISO 4217 currency code of the line, in lowercase.
line_items.prorationbooleanRequiredtruewhen the line is a proration from a change to the subscription's items.