Skip to Content
Paycose Docs
Credit notes

Credit notes

The credit_note_preview object

A credit note priced on an invoice without being created: what the invoice still has room to credit, each invoice line's limit, and the draft's lines and totals, priced the way POST /credit_notes prices them. Earlier credit notes count unless they were canceled or voided. Amounts are in the currency's smallest unit (for example 49900 = 499.00 THB).

Attributes

  • objectstringRequired

    String naming the object's type: always credit_note_preview.

  • invoicestringRequired

    ID of the invoice the credit note is for.

  • invoice_numberstringRequired

    The invoice's number.

  • invoice_statusstringRequired

    The invoice's status.

  • invoice_customerstringRequired

    The invoice's customer name, or its customer email when it has no name.

  • currencystringRequired

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

  • scaling_factorintegerRequired

    Number of smallest units in one unit of the currency, for example 100 for THB. Divide an amount by it to get major units.

  • blocked_reasonstring

    Why no credit note can be issued on the invoice; omitted when one can.

    • status

      The invoice is neither open nor paid.

    • no_provider_reference

      The invoice is hosted by a provider but has no reference at that provider yet.

  • invoice_totalintegerRequired

    The invoice's total.

  • invoice_amount_remainingintegerRequired

    What is still due on the invoice.

  • invoice_paidbooleanRequired

    true when nothing is due on the invoice.

  • pre_payment_credit_notes_amountintegerRequired

    What earlier credit notes on the invoice took off the amount due.

  • post_payment_credit_notes_amountintegerRequired

    What earlier credit notes on the invoice paid back after payment instead of taking it off the amount due.

  • already_creditedintegerRequired

    pre_payment_credit_notes_amount + post_payment_credit_notes_amount.

  • available_to_creditintegerRequired

    invoice_total − already_credited, never below 0.

  • invoice_linesarray of objectsRequired

    The invoice's lines, each with what earlier credit notes credited and the most still left to credit.

    Show child attributes
    • invoice_lines.objectstringRequired

      String naming the object's type: always credit_note_preview_invoice_line.

    • invoice_lines.idstringRequired

      ID of the invoice line. Pass it as a line's invoice_line_item to credit it.

    • invoice_lines.namestringRequired

      The line's product name, else its description, else its product ID.

    • invoice_lines.quantityintegerRequired

      The line's quantity.

    • invoice_lines.unit_amountintegerRequired

      The line's unit amount.

    • invoice_lines.amount_subtotalintegerRequired

      The line's subtotal, before discount and tax.

    • invoice_lines.credited_amountintegerRequired

      What earlier credit notes credited of the line's subtotal.

    • invoice_lines.max_amountintegerRequired

      The most still left to credit on the line: amount_subtotal − credited_amount, never below 0.

  • linesarray of objectsRequired

    The lines you sent, priced. A line naming an invoice line that is not on the invoice, or with an unknown type, is left out.

    Show child attributes
    • lines.typestringRequired

      The line's type, as you sent it.

      • invoice_line_item

        Credits part of a line of the invoice.

      • custom_line_item

        Credits a custom amount.

    • lines.invoice_line_itemstring

      ID of the invoice line credited; omitted for a custom_line_item.

    • lines.namestringRequired

      For an invoice line, its product name, else its description, else its product ID. For a custom line, the description you sent.

    • lines.amountintegerRequired

      Amount credited before tax. For an invoice line, the amount you sent, else the invoice line's price for the quantity you sent, else 0. For a custom line, unit_amount (or amount) × quantity, which defaults to 1.

    • lines.taxintegerRequired

      The line's share of the invoice line's tax, in proportion to amount; 0 for a custom line.

    • lines.totalintegerRequired

      What the line credits in all: the invoice line's total in proportion to amount, so it carries the line's discount and any tax added on top of the price. Equal to amount for a custom line.

    • lines.over_byintegerRequired

      How far amount exceeds what the invoice line has left to credit; 0 when it is within it.

  • subtotalintegerRequired

    Sum of the lines' amount, before tax.

  • taxintegerRequired

    Sum of the lines' tax.

  • shippingintegerRequired

    Shipping credited from shipping_cost; 0 when you sent none.

  • totalintegerRequired

    Sum of the lines' total, plus shipping.

  • amount_withholdingintegerRequired

    The part of total that reverses the invoice's withholding tax: the invoice's amount_withholding times this note's share of the invoice total, rounded half up. It was never paid, so only total less this is refunded or lowers what is due. post_payment_amount and pre_payment_amount split the rest.

  • post_payment_amountintegerRequired

    The part of total beyond what is still due on the invoice, which the invoice was already paid for. Creating the credit note needs a settlement destination for it (see settlement_options).

  • pre_payment_amountintegerRequired

    The part of total taken off what is still due: total − post_payment_amount.

  • remaining_afterintegerRequired

    available_to_credit − total: what is left to credit once this credit note is issued. Negative when it credits more than the invoice allows.

  • over_credited_linesintegerRequired

    Number of lines that credit more than their invoice line has left (over_by above 0).

  • settlement_requiredbooleanRequired

    true when post_payment_amount is above 0, so creating the credit note needs a settlement destination.

  • settlement_optionsarray of stringsRequired

    The settlement destinations post_payment_amount may go to. Each one other than none is the POST /credit_notes field that carries the amount.

    • none

      Nothing is paid back. Offered only while settlement_required is false.

    • refund_amount

      Refund the amount to the customer's payment method.

    • out_of_band_amount

      Record the amount as paid back outside Paycose.

    • credit_amount

      Add the amount to the customer's credit balance at the provider. Offered only when credit_balance_supported is true.

  • default_settlementstringRequired

    The settlement destination to start from.

    • none

      The invoice is not paid yet.

    • refund_amount

      The invoice is paid.

  • credit_balance_supportedbooleanRequired

    true when the invoice is hosted by a provider, which keeps a customer credit balance, so credit_amount is offered. false for an invoice Paycose bills itself.