Skip to Content
Paycose Docs
Invoices

Invoices

The invoice object

An invoice bills a customer for line items, fee lines, tax and shipping, less discounts. It starts as a draft, becomes open when it is finalized, and ends paid or void; an uncollectible invoice can still be paid or voided. You create invoices directly; subscriptions and accepted quotes create them for you.

Attributes

  • idstringRequired

    Unique identifier for the object.

  • objectstringRequired

    String naming the object's type.

  • livemodebooleanRequired

    true when the object exists in live mode, false in test mode.

  • createdtimestampRequired

    Time the object was created, in Unix seconds.

  • updatedtimestampRequired

    Time the object last changed, in Unix seconds.

  • numberstringRequired

    Sequential invoice number assigned when the invoice is created, for example INV2026020001. Empty in a preview.

  • quote_idstringRequired

    ID of the quote whose acceptance created this invoice. Empty otherwise.

  • subscription_idstringRequired

    ID of the subscription that created the invoice. Empty for other invoices.

  • test_clock_idstring

    ID of the test clock the invoice runs on. Only set in test mode, on invoices of a subscription attached to a test clock.

  • customer_idstringRequired

    ID of the customer the invoice is for. Empty on an invoice created without a customer until the payer enters their details at checkout; Paycose then records the payer as a customer and sets this field.

  • default_payment_method_idstringRequired

    ID of the saved payment method charged for this invoice. Empty when none is set; automatic collection then uses the subscription's default payment method, then the customer's.

  • payment_method_typestring

    Payment method type set as the invoice's default with default_payment_method.type, for example card or promptpay. Omitted when none was set.

  • collection_methodenumRequired

    How the invoice is collected: charge_automatically charges a saved payment method, send_invoice lets the customer pay it themselves.

    • charge_automatically

      Paycose charges the invoice's default payment method, else the subscription's or the customer's, when the invoice is finalized, and retries on failure.

    • send_invoice

      The customer pays the invoice themselves, by its due date when one is set.

  • capture_methodstringRequired

    How card payments for the invoice are captured: automatic captures at once, manual holds the authorization until you capture it.

    • automatic

      The payment is captured as soon as it is authorized.

    • manual

      The authorization is held and the payment is captured only when you capture it.

  • amount_capturableintegerRequired

    Amount authorized but not yet captured on the invoice's manual capture payments, in the smallest currency unit. Only computed when you retrieve a single invoice; 0 in lists and in the responses of other operations.

  • auto_advancebooleanRequired

    true when the invoice finalizes itself. A draft with auto_advance is finalized as soon as it is created or the flag is turned on; if that fails, Paycose retries the finalization later.

  • due_datetimestampNullable

    When payment is due, in Unix seconds. Set on send_invoice invoices: the date you set, the finalization time plus the invoice's days_until_due, or for a subscription's invoice the finalization time plus the subscription's days_until_due. Omitted when none is set.

  • days_until_dueintegerRequiredNullable

    Number of days after it is finalized that a send_invoice invoice falls due, as you set it on create or update. Null when not set, and always null on charge_automatically invoices.

  • descriptionstringRequired

    Memo shown on the invoice. Empty unless you set it with an update.

  • customer_namestringRequired

    Name of the customer, copied onto the invoice when it was created.

  • customer_emailstringRequired

    Email address of the customer, copied onto the invoice when it was created.

  • customer_phonestringRequired

    Phone number of the customer, copied onto the invoice when it was created.

  • customer_tax_idsarray of objectsRequired

    The customer's tax IDs as the invoice was issued: each type, value and, for a Thai tax ID, its branch. Copied from the customer (or the tax ID the payer entered at checkout) while the invoice is a draft and frozen when it is finalized, as Stripe's are; a provider-hosted invoice takes its provider's. [] when the customer has none, and on an invoice made before tax IDs were recorded, which the invoice PDF and dashboard fill from the customer as it is now.

    Show child attributes
    • customer_tax_ids.typestringRequired

      Type of the tax ID, as a tax ID type code from GET /tax_id_types.

    • customer_tax_ids.valuestringRequired

      The tax ID number.

    • customer_tax_ids.branchstring

      Branch number of a Thai tax ID, such as 00000 for the head office. Omitted when the tax ID has none.

  • addressobjectNullable

    The customer's billing address, copied onto the invoice when it was created and again when it is finalized: the customer's billing address (or its first address), else the billing details the payer entered at checkout. A provider-hosted invoice takes its provider's customer_address. Omitted when none is known.

    Show child attributes
    • address.idstring

      Unique identifier for the object.

    • address.address_typestringRequired

      Kind of address: billing or shipping as recorded on the customer or the request. A shipping address you send without a type is stored as shipping.

    • address.namestringRequired

      Name of the person or business at the address.

    • address.phonestringRequired

      Phone number for the address.

    • address.line1stringRequired

      First address line, such as the street and house number.

    • address.line2stringRequired

      Second address line, such as the building, floor or unit.

    • address.citystringRequired

      City, district or town.

    • address.statestringRequired

      State, province or region.

    • address.postal_codestringRequired

      Postal or ZIP code.

    • address.countrystringRequired

      Country, as it was entered.

  • line_itemsarray of objectsRequired

    The invoice's lines, product lines first and fee lines after them.

    Show child attributes
    • line_items.idstringRequired

      Unique identifier for the object.

    • line_items.objectstringRequired

      String naming the object's type.

    • line_items.product_idstringRequired

      ID of the product the line bills. On a fee line it holds the provider's product reference for the fee when a provider hosts the invoice, and is empty otherwise.

    • line_items.product_price_idstringRequired

      ID of the price the line bills. On a fee line it holds the provider's price reference for the fee when a provider hosts the invoice, and is empty otherwise.

    • line_items.sort_orderintegerRequired

      Position of the line among the invoice's lines, when one was assigned; 0 otherwise.

    • line_items.typestringRequired

      product for a line that bills a price, fee for a fee line. Can be empty on lines generated for a subscription period.

      • product

        A line that bills a price of a product.

      • fee

        A line that bills one of your fees, listed after the product lines.

    • line_items.descriptionstringRequired

      Text describing the line, normally the product or fee name.

    • line_items.product_namestringRequired

      Name of the product (or fee) at the time the line was created.

    • line_items.product_descriptionstringRequired

      Description of the product (or fee) at the time the line was created.

    • line_items.product_imagestringRequired

      URL of the product's image at the time the line was created. Empty when the product has none.

    • line_items.product_typestringRequired

      Kind of price the line bills: onetime, recurring or usage-based, or fee on a fee line. Can be empty on lines generated for a subscription period.

      • onetime

        The line bills a one-time price.

      • recurring

        The line bills a recurring price of a subscription.

      • usage-based

        The line bills a metered price, charged for reported usage.

      • fee

        The line bills a fee.

    • line_items.unit_amountintegerRequired

      Price of one unit, in the smallest currency unit. On a fee line it is the fee amount, fixed or computed as a percentage of the product lines.

    • line_items.quantityintegerRequired

      Number of units billed. Always 1 on fee lines.

    • line_items.amount_discountintegerRequired

      This line's share of the invoice's discount, in the smallest currency unit. 0 on fee lines.

    • line_items.amount_subtotalintegerRequired

      unit_amount times quantity, before discount and before tax added on top, in the smallest currency unit.

    • line_items.amount_taxintegerRequired

      Tax on the line, in the smallest currency unit, including tax already contained in a tax-inclusive price.

    • line_items.amount_totalintegerRequired

      Line amount after its discount share plus tax added on top, in the smallest currency unit (for example, 49900 is 499.00 THB).

    • line_items.currencystringRequired

      Three-letter ISO 4217 currency code, in lowercase.

    • line_items.discountablebooleanRequired

      true when the invoice's coupon can discount this line. Fee lines are never discountable.

    • line_items.withholding_taxbooleanRequired

      Whether the customer withholds Thai tax on this line; such a line counts in the document's amount_withholding.

    • line_items.prorationbooleanRequired

      true when the line is a proration created by a change to a subscription mid-period.

    • line_items.period_starttimestampRequiredNullable

      Start of the period the line bills, in Unix seconds. For a one-off product line it is the time the line was priced. null on fee lines.

    • line_items.period_endtimestampRequiredNullable

      End of the period the line bills, in Unix seconds. For a subscription line it is the end of the billing period; for a one-off product line it equals period_start. null on fee lines.

    • line_items.reference_idstringRequired

      The hosting provider's ID for the line when a provider hosts the invoice; otherwise an internal reference.

    • line_items.metadataobjectRequired

      Key-value pairs stored on the line. On a fee line it holds application_fee_id, the ID of the fee the line bills.

    • line_items.taxesarray of objectsRequired

      Taxes applied to the line, one entry per tax rate.

      Show child attributes
      • line_items.taxes.idstringRequired

        Unique identifier for the object.

      • line_items.taxes.tax_rate_idstringRequired

        ID of the tax rate applied.

      • line_items.taxes.taxable_amountintegerRequired

        Part of the line amount the rate taxes, in the smallest currency unit. For an inclusive rate it is the line amount without the tax it contains.

      • line_items.taxes.tax_amountintegerRequired

        Tax this rate charges on the line, in the smallest currency unit.

      • line_items.taxes.inclusivebooleanRequired

        true when the rate is tax-inclusive: the tax is already contained in the line amount and is not added on top.

  • discountsarray of objectsRequired

    Discounts applied to the invoice, one per coupon.

    Show child attributes
    • discounts.idstringRequired

      Unique identifier for the object.

    • discounts.coupon_idstringRequired

      ID of the coupon that gives the discount.

    • discounts.promotion_code_idstringRequired

      ID of the promotion code the coupon was applied through. Empty when the coupon was applied directly.

    • discounts.namestringRequired

      Name of the coupon.

    • discounts.amountintegerRequired

      Amount the discount takes off the invoice, in the smallest currency unit.

  • shipping_detailsobjectNullable

    Shipping address and shipping rate of the invoice. Omitted when the invoice has neither.

    Show child attributes
    • shipping_details.addressobjectNullable

      Address the order ships to. Omitted when the invoice has no shipping address.

      Show child attributes
      • shipping_details.address.idstring

        Unique identifier for the object.

      • shipping_details.address.address_typestringRequired

        Kind of address: billing or shipping as recorded on the customer or the request. A shipping address you send without a type is stored as shipping.

      • shipping_details.address.namestringRequired

        Name of the person or business at the address.

      • shipping_details.address.phonestringRequired

        Phone number for the address.

      • shipping_details.address.line1stringRequired

        First address line, such as the street and house number.

      • shipping_details.address.line2stringRequired

        Second address line, such as the building, floor or unit.

      • shipping_details.address.citystringRequired

        City, district or town.

      • shipping_details.address.statestringRequired

        State, province or region.

      • shipping_details.address.postal_codestringRequired

        Postal or ZIP code.

      • shipping_details.address.countrystringRequired

        Country, as it was entered.

    • shipping_details.rateobjectNullable

      Shipping rate charged on the invoice. Omitted when no shipping rate applies.

      Show child attributes
      • shipping_details.rate.idstringRequired

        Unique identifier for the object.

      • shipping_details.rate.display_namestringRequired

        Name of the shipping rate shown to the customer.

      • shipping_details.rate.typestringRequired

        Kind of shipping rate. Always fixed_amount.

        • fixed_amount

          A fixed shipping amount per invoice.

      • shipping_details.rate.currencystringRequired

        Three-letter ISO 4217 currency code, in lowercase.

      • shipping_details.rate.amountintegerRequired

        Shipping amount the rate charges, in the smallest currency unit.

  • subtotalintegerRequired

    Sum of the line amounts, fee lines included, before discounts and before tax added on top of prices, in the smallest currency unit.

  • taxintegerRequired

    Total tax on the invoice, in the smallest currency unit. It includes tax already contained in tax-inclusive prices, which is not added to total again.

  • totalintegerRequired

    Amount of the invoice after discounts, tax added on top and shipping, in the smallest currency unit (for example, 49900 is 499.00 THB).

  • amount_shippingintegerRequired

    Shipping charged on the invoice, in the smallest currency unit. 0 without shipping.

  • amount_discountintegerRequired

    Total discount applied to the invoice, in the smallest currency unit.

  • withholding_taxobjectRequiredNullable

    Thai withholding tax the customer deducts, as {"rate": 3}; null when it withholds nothing.

    Show child attributes
    • withholding_tax.rateintegerRequired

      Withholding percent: 1, 2, 3 or 5.

  • amount_withholdingintegerRequired

    Withholding tax in the smallest currency unit: withholding_tax.rate percent of the withheld lines' amount before VAT and after discounts, rounded half up once on their sum. Fees and shipping are never withheld. The customer pays amount_due = total − amount_withholding, and a paid invoice reads amount_paid + amount_withholding = total.

  • amount_dueintegerRequired

    Amount the customer owes for the invoice, in the smallest currency unit. It equals total less amount_withholding once the invoice is priced; for a provider-hosted invoice it is the provider's figure.

  • amount_paidintegerRequired

    Amount paid so far, in the smallest currency unit. Paying the invoice sets it to total less amount_withholding; refunding a payment lowers it again. An invoice marked paid out of band (paid_out_of_band) collected nothing here and reads 0, as at Stripe.

  • amount_remainingintegerRequired

    Amount still to be paid, in the smallest currency unit. It is 0 once the invoice is paid, except for an invoice marked paid out of band (paid_out_of_band), which keeps its amount_due here, as at Stripe. A credit note issued before payment lowers it, and a refund raises it.

  • starting_balanceintegerRequired

    Always 0. Paycose does not apply a customer credit balance to invoices.

  • pre_payment_credit_notes_amountintegerRequired

    Total of every credit note on the invoice that is not voided, in the smallest currency unit: the part that lowered what the customer owed before paying. Filled when you retrieve or list invoices; 0 in the responses of other operations.

  • post_payment_credit_notes_amountintegerRequired

    Total of every credit note on the invoice that is not voided, in the smallest currency unit: the part paid back to the customer (refunded, settled out of band or credited to their balance) after the invoice was paid. Filled when you retrieve or list invoices; 0 in the responses of other operations.

  • 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), for example 100 for THB. Divide an amount by it to get the value in major units.

  • transfer_dataobjectRequiredNullable

    Where the invoice's payment settles: the account it is for and the balance credited. An invoice you create without transfer_data settles to your own account. null when nothing was recorded.

    Show child attributes
    • transfer_data.destinationstringRequired

      ID of the connected account (acct_…) the document is for.

    • transfer_data.balance_idstringRequired

      ID of the balance the document's payments are booked to.

    • transfer_data.connectedbooleanRequired

      True when the destination is a connected account paid under Connect: what you owe it and your application fee are recorded on your ledger. False for a legacy destination.

  • on_behalf_ofstring

    ID of the connected account (acct_…) the invoice is issued on behalf of, when you set it. It always equals transfer_data.destination. Omitted otherwise.

  • statusenumRequired

    Where the invoice is in its lifecycle.

    • draft

      Being prepared. Its lines and pricing can change, and it can be deleted. It cannot be paid yet.

    • open

      Finalized and waiting for payment. Only presentational fields can change; it can be paid, voided, marked paid or become uncollectible.

    • paid

      Paid in full, through Paycose or out of band. Final; use a credit note to reduce it.

    • void

      Canceled after finalization. Final; it can no longer be paid.

    • uncollectible

      Written off after automatic payment attempts ran out, or marked so by the hosting provider. It can still be marked paid or voided.

  • paidbooleanRequired

    true when status is paid.

  • paid_out_of_bandbooleanRequired

    true when the invoice was marked paid for a payment made outside Paycose, such as cash or a bank transfer. Such an invoice reads amount_paid 0, amount_remaining equal to amount_due and no payment_intent.

  • attemptedbooleanRequired

    true once an automatic payment attempt has been made on the invoice, whether it succeeded or failed.

  • attempt_countintegerRequired

    Number of automatic payment attempts made on the invoice so far.

  • next_payment_attempttimestampNullable

    When the next automatic payment attempt is scheduled, in Unix seconds. Omitted when no retry is pending.

  • payment_intentstring

    ID of the payment intent used by the most recent automatic payment attempt. Omitted when none was made. Every payment made against the invoice is listed by GET /invoices/{id}/payments.

  • last_finalization_errorobject

    Why the last attempt to finalize this draft failed, as Stripe shapes it: code (the Paycose error code, such as E4202), type (such as invalid_request_error or api_error) and message. Finalizing the invoice clears it. A failed payment never sets it; that reason is on the payment intent. Omitted when finalization has not failed.

  • status_transitionsobjectRequired

    When the invoice was finalized, paid, voided or marked uncollectible.

    Show child attributes
    • status_transitions.finalized_atintegerRequiredNullable

      When the invoice was finalized and became open. Marking a draft paid also sets it.

    • status_transitions.paid_atintegerRequiredNullable

      When the invoice became paid.

    • status_transitions.voided_atintegerRequiredNullable

      When the invoice was voided.

    • status_transitions.marked_uncollectible_atintegerRequiredNullable

      When the invoice became uncollectible.

  • providerstringRequired

    Name of the payment provider the invoice is billed and collected through, for example stripe or omise: the first of payment_method_providers your account routes, else the provider the default payment method is saved on, else your card provider; a subscription's invoice has the subscription's. When that provider bills on its own side it hosts the invoice; otherwise Paycose bills it and collects through that provider.

  • reference_idstringRequired

    The hosting provider's own ID for the invoice. Empty for invoices Paycose bills.

  • paymentsarray of objects (invoice_payment)

    Payments made against the invoice. Only included when you retrieve a single invoice.

  • hosted_invoice_urlstring

    Link to a page where the customer can view and pay the invoice: the provider's page for a provider-hosted invoice, or Paycose's hosted page for an invoice Paycose bills. Set when the invoice is finalized; omitted for a draft.

  • invoice_pdfstring

    URL of the invoice PDF made by the hosting provider. Omitted for invoices Paycose bills.

  • provider_numberstring

    The hosting provider's own number for the invoice; number stays Paycose's. Omitted for invoices Paycose bills.

  • billing_reasonstring

    Why the invoice was created. Subscription invoices say which billing event made them; a provider-hosted invoice can carry the provider's own reason. Omitted on invoices you create with POST /invoices.

    • subscription_create

      First invoice of a new subscription.

    • subscription_cycle

      Renewal invoice for a new billing period of a subscription.

    • subscription_update

      Invoice for a change to a subscription, such as prorations.

    • subscription_threshold

      Invoice raised early because a subscription's usage reached its billing threshold.

    • manual

      Reported by the hosting provider for an invoice created directly rather than by a subscription.

  • receipt_idstring

    ID of the receipt issued when the invoice was paid. Omitted until then.

  • metadataobjectRequired

    Key-value pairs you attach to the object for your own use. Paycose never reads or changes them.

  • default_tax_ratesarray of stringsRequired

    IDs of the tax rates the invoice applies by default, read from its lines: the rates on its fee lines or, when it has no fee lines, the rates all its product lines share.

  • account_tax_idsarray of stringsRequired

    Tax IDs of your business recorded on the invoice, as you sent them. When a provider hosts the invoice they are passed to it unchanged.

  • payment_method_typesarray of stringsRequired

    Payment method types the payer may use for this invoice. Empty means any type available to your account.

  • payment_method_providersarray of stringsRequired

    Providers the payer may pay through, by name. Empty means any provider that serves the payment method.

  • customerobject (customer)NullableExpandable

    The full customer object when you pass expand[]=customer; otherwise omitted. Use customer_id.

  • billing_detailsobjectNullable

    Billing and tax details the payer entered on the hosted checkout page for this invoice. Omitted when none were collected.

    Show child attributes
    • billing_details.namestring

      Payer's name, up to 255 characters. Omitted when not given.

      Max length 255

    • billing_details.emailstring

      Payer's email address. Omitted when not given.

      Max length 254 · Format email

    • billing_details.phonestring

      Payer's phone number, up to 64 characters. Omitted when not given.

      Max length 64

    • billing_details.addressobjectNullable

      Payer's billing address. Omitted when not given.

      Show child attributes
      • billing_details.address.line1string

        First line of the address, such as street and house number. Up to 255 characters.

        Max length 255

      • billing_details.address.line2string

        Second line of the address, such as building or unit. Up to 255 characters.

        Max length 255

      • billing_details.address.citystring

        City or district. Up to 255 characters.

        Max length 255

      • billing_details.address.statestring

        State, province or region. Up to 255 characters.

        Max length 255

      • billing_details.address.postal_codestring

        Postal code. Up to 32 characters.

        Max length 32

      • billing_details.address.countrystring

        Two-letter ISO 3166-1 country code, in uppercase.

        Pattern ^[A-Z]{2}$

    • billing_details.business_namestring

      Name of the payer's business, up to 255 characters. Omitted when not given.

      Max length 255

    • billing_details.tax_idobjectNullable

      Payer's tax ID. Omitted when not given.

      Show child attributes
      • billing_details.tax_id.typestringRequired

        Type of the tax ID, as a tax ID type code from GET /tax_id_types. Up to 64 characters.

        Max length 64

      • billing_details.tax_id.valuestringRequired

        The tax ID number. Up to 255 characters; checked against the type's format.

        Max length 255

  • default_payment_methodobject (payment_method)NullableExpandable

    The full payment method object when you pass expand[]=default_payment_method; otherwise omitted. Use default_payment_method_id.

  • quotestring | object (quote)Expandable

    The full quote object when you pass expand[]=quote; otherwise omitted. Use quote_id.

  • subscriptionstring | object (subscription)Expandable

    The full subscription object when you pass expand[]=subscription; otherwise omitted. Use subscription_id.