Skip to main content
POST
/
v1
/
credit_notes
/
preview
Preview a credit note
curl --request POST \
  --url https://api.yorlet.com/v1/credit_notes/preview \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "invoice": "<string>",
  "lines": [
    {
      "amount": 123,
      "invoice_item": "<string>",
      "type": "invoice_item"
    }
  ],
  "credit_amount": 123,
  "memo": "<string>",
  "metadata": {},
  "out_of_band_amount": 123
}
'
{
  "id": "<string>",
  "created": 123,
  "object": "credit_note",
  "amount": 123,
  "currency": "gbp",
  "customer": "<string>",
  "description": "<string>",
  "discount_amount": 123,
  "invoice": "<string>",
  "memo": "<string>",
  "number": "<string>",
  "voided_at": 123,
  "account": "<string>",
  "deleted": false,
  "credit_amount": 0,
  "lines": [
    {
      "id": "<string>",
      "created": 123,
      "object": "credit_note_line_item",
      "amount": 123,
      "amount_excluding_tax": 123,
      "credit_note": "<string>",
      "currency": "gbp",
      "description": "<string>",
      "invoice_item": "<string>",
      "pretax_credit_amounts": [
        {
          "amount": 123,
          "credit_grant": "<string>",
          "display_name": "<string>",
          "invoice_item": "<string>",
          "type": "credit_grant"
        }
      ],
      "tax_amounts": [
        {
          "amount": 123,
          "tax_rate": 123,
          "taxable_amount": 123
        }
      ],
      "type": "invoice_item",
      "account": "<string>",
      "deleted": false
    }
  ],
  "metadata": {},
  "out_of_band_amount": 0,
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "tax_amounts": [],
  "tax": 0,
  "total": 0,
  "total_excluding_tax": 0,
  "total_pretax_credit_amounts": []
}

Authorizations

Authorization
string
header
required

API Key authentication. Use "Bearer YOUR_API_KEY".

Body

application/json
invoice
string
required

The ID of the invoice the credit note is for.

Pattern: ^[a-zA-Z0-9_]+$
lines
object[]
required

A list of up to 10 line items to issue credit for.

Required array length: 1 - 10 elements
credit_amount
integer

The integer amount in cents representing the amount to credit the customer’s balance, which will be automatically applied to their next invoice.

memo
string | null

The credit note’s memo appears on the credit note PDF.

metadata
object

The metadata for the credit note.

new_invoice_data
object

The data for the new invoice.

out_of_band_amount
integer

The credit note amount that was paid out of band.

reason
enum<string>

The reason for issuing the credit note.

Available options:
duplicate,
fraudulent,
order_change,
product_unsatisfactory,
other

Response

200 - application/json

Returns a credit note preview object if successful.

id
string
required

Unique identifier for the object.

created
number
required

Time at which the object was created. Measured in seconds since the Unix epoch.

object
enum<string>
required
Available options:
credit_note
amount
number
required

The amount of the credit note.

currency
enum<string>
required

Three-letter ISO currency code, in lowercase. Must be a supported currency.

Available options:
gbp,
usd,
eur,
sek
Example:

"gbp"

customer
required
description
string | null
required

The description of the credit note.

discount_amount
number
required

The amount of the discount for the credit note.

invoice
required
memo
string | null
required

The credit note’s memo appears on the credit note PDF.

number
string | null
required

The credit note number.

reason
enum<string>
required

The reason for issuing the credit note.

Available options:
duplicate,
fraudulent,
order_change,
product_unsatisfactory,
other
status
enum<string>
required

The status of the credit note.

Available options:
issued,
voided
type
enum<string>
required

The type of the credit note.

Available options:
pre_payment,
post_payment
voided_at
number | null
required

The date and time the credit note was voided.

account
string

The account that the object belongs to. Only returned if the request is made with a valid Yorlet-Context header.

deleted
boolean
default:false

Only returned if the object has been deleted.

credit_amount
number
default:0

The integer amount in cents representing the amount to credit the customer’s balance, which will be automatically applied to their next invoice.

lines
object[]
metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

out_of_band_amount
number
default:0

The credit note amount that was paid out of band.

subtotal
number
default:0

The credit note’s subtotal.

subtotal_excluding_tax
number
default:0

The credit note’s subtotal excluding tax.

tax_amounts
object[]

The tax amounts for the credit note.

tax
number
default:0

The credit note’s tax amount.

total
number
default:0

The credit note’s total amount.

total_excluding_tax
number
default:0

The credit note’s total amount excluding tax.

total_pretax_credit_amounts
object[]

The pretax credit amounts for the credit note.