Skip to Content
Paycose Docs
Subscriptions

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

  • objectstringRequired

    String naming the object's type, upcoming_invoice.

  • sourcestringRequired

    Where the preview's amounts come from.

    • provider

      The provider that bills the subscription returned the preview.

    • estimated

      Paycose estimated the preview from the subscription. Usage-based lines are priced at the usage recorded so far, without tax.

  • currencystringRequired

    Three-letter ISO 4217 currency code, in lowercase.

  • scaling_factorintegerRequired

    Number of smallest currency units in one unit of currency (10 to the power of the currency's decimal places), e.g. 100 for THB. Divide an amount by it to get the value in major units.

  • subtotalintegerRequired

    Sum of the lines' amounts before discount and tax, in the smallest currency unit.

  • taxintegerRequired

    Total tax on the lines, in the smallest currency unit. Inclusive tax is counted here but is already part of the line amounts.

  • amount_discountintegerRequired

    Total discount on the lines, in the smallest currency unit.

  • totalintegerRequired

    Amount the next invoice is expected to charge, in the smallest currency unit (for example, 49900 is 499.00 THB).

  • period_starttimestampRequiredNullable

    Start 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_endtimestampRequiredNullable

    End of the period the preview is based on, in Unix seconds. Null when the provider's preview gives no period.

  • next_payment_attimestampRequiredNullable

    When 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 objectsRequired

    The 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_idstring

      ID of the product billed. Absent on fee lines and on lines of a provider preview.

    • line_items.product_price_idstring

      ID of the price billed. On a provider preview this is the provider's own price ID. Absent when the line has no price.

    • line_items.product_namestring

      Name of the product, or the item's description on a pending one-time item or proration. Absent on lines of a provider preview.

    • line_items.descriptionstring

      Text describing the line. Absent when there is none.

    • line_items.typestring

      Kind of line. Absent on lines of a provider preview.

      • product

        A recurring line of the subscription.

      • fee

        A fee line of the subscription.

      • onetime

        A one-time item from add_invoice_items that has not been billed yet.

      • proration

        A proration from a line item change that has not been billed yet.

    • line_items.unit_amountintegerRequired

      Price of one unit, in the smallest currency unit.

    • line_items.quantityintegerRequired

      Number of units. On a usage-based line of an estimate, the usage recorded so far in the current period.

    • line_items.amount_subtotalintegerRequired

      Amount of the line before discount and tax, in the smallest currency unit.

    • line_items.amount_discountintegerRequired

      Discount on the line, in the smallest currency unit.

    • line_items.amount_taxintegerRequired

      Tax on the line, in the smallest currency unit. Inclusive tax is counted here but is already part of amount_subtotal.

    • line_items.amount_totalintegerRequired

      Amount of the line after discount, with exclusive tax added, in the smallest currency unit (for example, 49900 is 499.00 THB).

    • line_items.currencystring

      Three-letter ISO 4217 currency code of the line, in lowercase.

    • line_items.prorationbooleanRequired

      true when the line is a proration from a change to the subscription's items.