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
objectstringRequiredString naming the object's type: always
credit_note_preview.invoicestringRequiredID of the invoice the credit note is for.
invoice_numberstringRequiredThe invoice's number.
invoice_statusstringRequiredThe invoice's status.
invoice_customerstringRequiredThe invoice's customer name, or its customer email when it has no name.
currencystringRequiredThree-letter ISO 4217 currency code of the invoice, in lowercase.
scaling_factorintegerRequiredNumber of smallest units in one unit of the currency, for example
100for THB. Divide an amount by it to get major units.blocked_reasonstringWhy no credit note can be issued on the invoice; omitted when one can.
statusThe invoice is neither
opennorpaid.no_provider_referenceThe invoice is hosted by a provider but has no reference at that provider yet.
invoice_totalintegerRequiredThe invoice's total.
invoice_amount_remainingintegerRequiredWhat is still due on the invoice.
invoice_paidbooleanRequiredtruewhen nothing is due on the invoice.pre_payment_credit_notes_amountintegerRequiredWhat earlier credit notes on the invoice took off the amount due.
post_payment_credit_notes_amountintegerRequiredWhat earlier credit notes on the invoice paid back after payment instead of taking it off the amount due.
already_creditedintegerRequiredpre_payment_credit_notes_amount+post_payment_credit_notes_amount.available_to_creditintegerRequiredinvoice_total−already_credited, never below0.invoice_linesarray of objectsRequiredThe invoice's lines, each with what earlier credit notes credited and the most still left to credit.
Show child attributes
invoice_lines.objectstringRequiredString naming the object's type: always
credit_note_preview_invoice_line.invoice_lines.idstringRequiredID of the invoice line. Pass it as a line's
invoice_line_itemto credit it.invoice_lines.namestringRequiredThe line's product name, else its description, else its product ID.
invoice_lines.quantityintegerRequiredThe line's quantity.
invoice_lines.unit_amountintegerRequiredThe line's unit amount.
invoice_lines.amount_subtotalintegerRequiredThe line's subtotal, before discount and tax.
invoice_lines.credited_amountintegerRequiredWhat earlier credit notes credited of the line's subtotal.
invoice_lines.max_amountintegerRequiredThe most still left to credit on the line:
amount_subtotal−credited_amount, never below0.
linesarray of objectsRequiredThe 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.typestringRequiredThe line's
type, as you sent it.invoice_line_itemCredits part of a line of the invoice.
custom_line_itemCredits a custom amount.
lines.invoice_line_itemstringID of the invoice line credited; omitted for a
custom_line_item.lines.namestringRequiredFor an invoice line, its product name, else its description, else its product ID. For a custom line, the
descriptionyou sent.lines.amountintegerRequiredAmount credited before tax. For an invoice line, the
amountyou sent, else the invoice line's price for thequantityyou sent, else0. For a custom line,unit_amount(oramount) ×quantity, which defaults to1.lines.taxintegerRequiredThe line's share of the invoice line's tax, in proportion to
amount;0for a custom line.lines.totalintegerRequiredWhat 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 toamountfor a custom line.lines.over_byintegerRequiredHow far
amountexceeds what the invoice line has left to credit;0when it is within it.
subtotalintegerRequiredSum of the lines'
amount, before tax.taxintegerRequiredSum of the lines'
tax.shippingintegerRequiredShipping credited from
shipping_cost;0when you sent none.totalintegerRequiredSum of the lines'
total, plusshipping.amount_withholdingintegerRequiredThe part of
totalthat reverses the invoice's withholding tax: the invoice'samount_withholdingtimes this note's share of the invoicetotal, rounded half up. It was never paid, so onlytotalless this is refunded or lowers what is due.post_payment_amountandpre_payment_amountsplit the rest.post_payment_amountintegerRequiredThe part of
totalbeyond what is still due on the invoice, which the invoice was already paid for. Creating the credit note needs a settlement destination for it (seesettlement_options).pre_payment_amountintegerRequiredThe part of
totaltaken off what is still due:total−post_payment_amount.remaining_afterintegerRequiredavailable_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_linesintegerRequiredNumber of
linesthat credit more than their invoice line has left (over_byabove0).settlement_requiredbooleanRequiredtruewhenpost_payment_amountis above0, so creating the credit note needs a settlement destination.settlement_optionsarray of stringsRequiredThe settlement destinations
post_payment_amountmay go to. Each one other thannoneis thePOST /credit_notesfield that carries the amount.noneNothing is paid back. Offered only while
settlement_requiredisfalse.refund_amountRefund the amount to the customer's payment method.
out_of_band_amountRecord the amount as paid back outside Paycose.
credit_amountAdd the amount to the customer's credit balance at the provider. Offered only when
credit_balance_supportedistrue.
default_settlementstringRequiredThe settlement destination to start from.
noneThe invoice is not paid yet.
refund_amountThe invoice is paid.
credit_balance_supportedbooleanRequiredtruewhen the invoice is hosted by a provider, which keeps a customer credit balance, socredit_amountis offered.falsefor an invoice Paycose bills itself.