API reference

Credit Notes

Issue a credit note to adjust an invoice's amount after the invoice is finalized. Related guide: Credit notes

Knox answers these operations with the same requests and responses as Stripe's API. Authenticate with your secret key, Authorization: Bearer sk_test_..., from your server, and send form-encoded bodies. Test mode only: live processing is currently disabled.

Create a credit note

POST/v1/credit_notes

Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice’s amount_remaining (and amount_due), but not below zero. This amount is indicated by the credit note’s pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following: Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds). Customer balance credit: credit the customer’s balance (using credit_amount) which will be automatically applied to their next invoice when it’s finalized. Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount). The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount. You may issue multiple credit notes for an invoice. Each credit note may increment the invoice’s pre_payment_credit_notes_amount, post_payment_credit_notes_amount, or both, depending on the invoice’s amount_remaining at the time of credit note creation. For invoices that also have refunds created through the Refund API, the credit note API subtracts those refund amounts from the maximum creditable amount. This prevents the combined credit notes and refunds from exceeding the invoice amount. If you use both, ensure the combined total does not exceed the invoice’s paid amount.

Body parameters

  • invoicestringRequired

    ID of the invoice.

  • amountinteger

    The integer amount in cents (or local equivalent) representing the total amount of the credit note. One of amount, lines, or shipping_cost must be provided.

  • credit_amountinteger

    The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.

  • effective_atinteger

    The date when this credit note is in effect. Same as created unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.

  • email_typestring

    Type of email to send to the customer, one of credit_note or none and the default is credit_note.

    Possible values
    • credit_note
    • none
  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • linesarray of objects

    Line items that make up the credit note. One of amount, lines, or shipping_cost must be provided.

    Show 10 child parameters
    • typestringRequired
      Possible values
      • custom_line_item
      • invoice_line_item
    • amountinteger
    • descriptionstring
    • invoice_line_itemstring
    • metadataobject
    • quantityinteger
    • tax_amountsarray of objects
      Show 3 child parameters
      • amountintegerRequired
      • tax_ratestringRequired
      • taxable_amountintegerRequired
    • tax_ratesarray of strings
    • unit_amountinteger
    • unit_amount_decimalstring
  • memostring

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

  • metadataobject

    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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • out_of_band_amountinteger

    The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.

  • reasonstring

    Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory

    Possible values
    • duplicate
    • fraudulent
    • order_change
    • product_unsatisfactory
  • refund_amountinteger

    The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.

  • refundsarray of objects

    Refunds to link to this credit note.

    Show 4 child parameters
    • amount_refundedinteger
    • payment_record_refundobject
      Show 2 child parameters
      • payment_recordstringRequired
      • refund_groupstringRequired
    • refundstring
    • typestring
      Possible values
      • payment_record_refund
      • refund
  • shipping_costobject

    When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. One of amount, lines, or shipping_cost must be provided.

    Show 1 child parameter
    • shipping_ratestring

Returns

The credit_note object.

POST /v1/credit_notes
curl https://api.knoxapi.com/v1/credit_notes \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  -d invoice=in_1Pgc75B7WZ01zgkWYv4iMwt7
Response
{
  "amount": 1690,
  "amount_shipping": 0,
  "created": 1234567890,
  "currency": "usd",
  "customer": "cus_QXg1o8vcGmoR32",
  "customer_balance_transaction": null,
  "discount_amount": 0,
  "discount_amounts": [],
  "effective_at": 1234567890,
  "id": "cn_1Pgc75B7WZ01zgkWJMPt5riP",
  "invoice": "in_1Pgc75B7WZ01zgkWYv4iMwt7",
  "lines": {
    "data": [
      {
        "amount": 1190,
        "description": "My First Invoice Item (created for API docs)",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkWla6u0GdZ",
        "invoice_line_item": "il_1Pgc74B7WZ01zgkWWh45tUBA",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [
          {
            "active": true,
            "country": "DE",
            "created": 1721954066,
            "description": "VAT Germany",
            "display_name": "VAT",
            "effective_percentage": null,
            "id": "txr_1Pgc74B7WZ01zgkW94BlEhHU",
            "inclusive": false,
            "jurisdiction": "DE",
            "jurisdiction_level": null,
            "livemode": false,
            "metadata": {},
            "object": "tax_rate",
            "percentage": 19,
            "state": null,
            "tax_type": "vat",
            "flat_amount": {
              "amount": 1413853096,
              "currency": "currency"
            },
            "rate_type": null
          }
        ],
        "type": "invoice_line_item",
        "unit_amount": null,
        "unit_amount_decimal": null,
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      },
      {
        "amount": 500,
        "description": "Service credit",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkW9m0EaOVh",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [],
        "type": "custom_line_item",
        "unit_amount": 500,
        "unit_amount_decimal": "500",
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      }
    ],
    "has_more": false,
    "object": "list",
    "url": "/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/lines"
  },
  "livemode": false,
  "memo": null,
  "metadata": {},
  "number": "ABCD-1234-CN-01",
  "object": "credit_note",
  "out_of_band_amount": null,
  "pdf": "https://sangeekp-15t6ai--manage-mydev.dev.stripe.me/credit_notes/acct_1PgafTB7WZ01zgkW/cnst_123456789/pdf?s=ap",
  "shipping_cost": {
    "amount_subtotal": 1555417355,
    "amount_tax": 1424534716,
    "amount_total": 1117121693,
    "shipping_rate": null
  },
  "status": "issued",
  "subtotal": 1690,
  "subtotal_excluding_tax": 1690,
  "total": 1690,
  "total_excluding_tax": null,
  "type": "pre_payment",
  "voided_at": 1234567890,
  "pretax_credit_amounts": [
    {
      "amount": 1413853096,
      "type": "credit_balance_transaction"
    }
  ],
  "total_taxes": null,
  "refunds": [
    {
      "amount_refunded": 1387154914,
      "refund": "refund",
      "payment_record_refund": {
        "payment_record": "payment_record",
        "refund_group": "refund_group"
      },
      "type": null
    }
  ],
  "post_payment_amount": 1355257296,
  "pre_payment_amount": 251024947,
  "reason": null,
  "customer_account": null
}

List all credit notes

GET/v1/credit_notes

Returns a list of credit notes.

Query parameters

  • createdobject | integer

    Only return credit notes that were created during the given date interval.

    Show 4 child parameters
    • gtinteger
    • gteinteger
    • ltinteger
    • lteinteger
  • customerstring

    Only return credit notes for the customer specified by this customer ID.

  • customer_accountstring

    Only return credit notes for the account representing the customer specified by this account ID.

  • ending_beforestring

    A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • invoicestring

    Only return credit notes for the invoice specified by this invoice ID.

  • limitinteger

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

  • starting_afterstring

    A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

Returns

A list of credit_note objects.

GET /v1/credit_notes
curl -G https://api.knoxapi.com/v1/credit_notes \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  --data-urlencode limit=3
Response
{
  "object": "list",
  "url": "/v1/credit_notes",
  "has_more": false,
  "data": [
    {
      "amount": 1690,
      "amount_shipping": 0,
      "created": 1234567890,
      "currency": "usd",
      "customer": "cus_QXg1o8vcGmoR32",
      "customer_balance_transaction": null,
      "discount_amount": 0,
      "discount_amounts": [],
      "effective_at": 1234567890,
      "id": "cn_1Pgc75B7WZ01zgkWJMPt5riP",
      "invoice": "in_1Pgc75B7WZ01zgkWYv4iMwt7",
      "lines": {
        "data": [
          {
            "amount": 1190,
            "description": "My First Invoice Item (created for API docs)",
            "discount_amount": 0,
            "discount_amounts": [],
            "id": "cnli_1Pgc75B7WZ01zgkWla6u0GdZ",
            "invoice_line_item": "il_1Pgc74B7WZ01zgkWWh45tUBA",
            "livemode": false,
            "object": "credit_note_line_item",
            "quantity": 1,
            "tax_rates": [
              {
                "active": true,
                "country": "DE",
                "created": 1721954066,
                "description": "VAT Germany",
                "display_name": "VAT",
                "effective_percentage": null,
                "id": "txr_1Pgc74B7WZ01zgkW94BlEhHU",
                "inclusive": false,
                "jurisdiction": "DE",
                "jurisdiction_level": null,
                "livemode": false,
                "metadata": {},
                "object": "tax_rate",
                "percentage": 19,
                "state": null,
                "tax_type": "vat",
                "flat_amount": {
                  "amount": 1413853096,
                  "currency": "currency"
                },
                "rate_type": null
              }
            ],
            "type": "invoice_line_item",
            "unit_amount": null,
            "unit_amount_decimal": null,
            "pretax_credit_amounts": [
              {
                "amount": 1413853096,
                "type": "credit_balance_transaction"
              }
            ],
            "taxes": null,
            "metadata": null
          },
          {
            "amount": 500,
            "description": "Service credit",
            "discount_amount": 0,
            "discount_amounts": [],
            "id": "cnli_1Pgc75B7WZ01zgkW9m0EaOVh",
            "livemode": false,
            "object": "credit_note_line_item",
            "quantity": 1,
            "tax_rates": [],
            "type": "custom_line_item",
            "unit_amount": 500,
            "unit_amount_decimal": "500",
            "pretax_credit_amounts": [
              {
                "amount": 1413853096,
                "type": "credit_balance_transaction"
              }
            ],
            "taxes": null,
            "metadata": null
          }
        ],
        "has_more": false,
        "object": "list",
        "url": "/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/lines"
      },
      "livemode": false,
      "memo": null,
      "metadata": {},
      "number": "ABCD-1234-CN-01",
      "object": "credit_note",
      "out_of_band_amount": null,
      "pdf": "https://sangeekp-15t6ai--manage-mydev.dev.stripe.me/credit_notes/acct_1PgafTB7WZ01zgkW/cnst_123456789/pdf?s=ap",
      "shipping_cost": {
        "amount_subtotal": 1555417355,
        "amount_tax": 1424534716,
        "amount_total": 1117121693,
        "shipping_rate": null
      },
      "status": "issued",
      "subtotal": 1690,
      "subtotal_excluding_tax": 1690,
      "total": 1690,
      "total_excluding_tax": null,
      "type": "pre_payment",
      "voided_at": 1234567890,
      "pretax_credit_amounts": [
        {
          "amount": 1413853096,
          "type": "credit_balance_transaction"
        }
      ],
      "total_taxes": null,
      "refunds": [
        {
          "amount_refunded": 1387154914,
          "refund": "refund",
          "payment_record_refund": {
            "payment_record": "payment_record",
            "refund_group": "refund_group"
          },
          "type": null
        }
      ],
      "post_payment_amount": 1355257296,
      "pre_payment_amount": 251024947,
      "reason": null,
      "customer_account": null
    }
  ]
}

Preview a credit note

GET/v1/credit_notes/preview

Get a preview of a credit note without creating it.

Query parameters

  • invoicestringRequired

    ID of the invoice.

  • amountinteger

    The integer amount in cents (or local equivalent) representing the total amount of the credit note. One of amount, lines, or shipping_cost must be provided.

  • credit_amountinteger

    The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.

  • effective_atinteger

    The date when this credit note is in effect. Same as created unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.

  • email_typestring

    Type of email to send to the customer, one of credit_note or none and the default is credit_note.

    Possible values
    • credit_note
    • none
  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • linesarray of objects

    Line items that make up the credit note. One of amount, lines, or shipping_cost must be provided.

    Show 10 child parameters
    • typestringRequired
      Possible values
      • custom_line_item
      • invoice_line_item
    • amountinteger
    • descriptionstring
    • invoice_line_itemstring
    • metadataobject
    • quantityinteger
    • tax_amountsarray of objects
      Show 3 child parameters
      • amountintegerRequired
      • tax_ratestringRequired
      • taxable_amountintegerRequired
    • tax_ratesarray of strings
    • unit_amountinteger
    • unit_amount_decimalstring
  • memostring

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

  • metadataobject

    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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • out_of_band_amountinteger

    The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.

  • reasonstring

    Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory

    Possible values
    • duplicate
    • fraudulent
    • order_change
    • product_unsatisfactory
  • refund_amountinteger

    The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.

  • refundsarray of objects

    Refunds to link to this credit note.

    Show 4 child parameters
    • amount_refundedinteger
    • payment_record_refundobject
      Show 2 child parameters
      • payment_recordstringRequired
      • refund_groupstringRequired
    • refundstring
    • typestring
      Possible values
      • payment_record_refund
      • refund
  • shipping_costobject

    When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. One of amount, lines, or shipping_cost must be provided.

    Show 1 child parameter
    • shipping_ratestring

Returns

The credit_note object.

GET /v1/credit_notes/preview
curl -G https://api.knoxapi.com/v1/credit_notes/preview \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  --data-urlencode invoice=in_1Pgc75B7WZ01zgkWYv4iMwt7
Response
{
  "amount": 1690,
  "amount_shipping": 0,
  "created": 1234567890,
  "currency": "usd",
  "customer": "cus_QXg1o8vcGmoR32",
  "customer_balance_transaction": null,
  "discount_amount": 0,
  "discount_amounts": [],
  "effective_at": 1234567890,
  "id": "cn_1Pgc75B7WZ01zgkWJMPt5riP",
  "invoice": "in_1Pgc75B7WZ01zgkWYv4iMwt7",
  "lines": {
    "data": [
      {
        "amount": 1190,
        "description": "My First Invoice Item (created for API docs)",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkWla6u0GdZ",
        "invoice_line_item": "il_1Pgc74B7WZ01zgkWWh45tUBA",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [
          {
            "active": true,
            "country": "DE",
            "created": 1721954066,
            "description": "VAT Germany",
            "display_name": "VAT",
            "effective_percentage": null,
            "id": "txr_1Pgc74B7WZ01zgkW94BlEhHU",
            "inclusive": false,
            "jurisdiction": "DE",
            "jurisdiction_level": null,
            "livemode": false,
            "metadata": {},
            "object": "tax_rate",
            "percentage": 19,
            "state": null,
            "tax_type": "vat",
            "flat_amount": {
              "amount": 1413853096,
              "currency": "currency"
            },
            "rate_type": null
          }
        ],
        "type": "invoice_line_item",
        "unit_amount": null,
        "unit_amount_decimal": null,
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      },
      {
        "amount": 500,
        "description": "Service credit",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkW9m0EaOVh",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [],
        "type": "custom_line_item",
        "unit_amount": 500,
        "unit_amount_decimal": "500",
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      }
    ],
    "has_more": false,
    "object": "list",
    "url": "/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/lines"
  },
  "livemode": false,
  "memo": null,
  "metadata": {},
  "number": "ABCD-1234-CN-01",
  "object": "credit_note",
  "out_of_band_amount": null,
  "pdf": "https://sangeekp-15t6ai--manage-mydev.dev.stripe.me/credit_notes/acct_1PgafTB7WZ01zgkW/cnst_123456789/pdf?s=ap",
  "shipping_cost": {
    "amount_subtotal": 1555417355,
    "amount_tax": 1424534716,
    "amount_total": 1117121693,
    "shipping_rate": null
  },
  "status": "issued",
  "subtotal": 1690,
  "subtotal_excluding_tax": 1690,
  "total": 1690,
  "total_excluding_tax": null,
  "type": "pre_payment",
  "voided_at": 1234567890,
  "pretax_credit_amounts": [
    {
      "amount": 1413853096,
      "type": "credit_balance_transaction"
    }
  ],
  "total_taxes": null,
  "refunds": [
    {
      "amount_refunded": 1387154914,
      "refund": "refund",
      "payment_record_refund": {
        "payment_record": "payment_record",
        "refund_group": "refund_group"
      },
      "type": null
    }
  ],
  "post_payment_amount": 1355257296,
  "pre_payment_amount": 251024947,
  "reason": null,
  "customer_account": null
}

Update a credit note

POST/v1/credit_notes/{id}

Updates an existing credit note.

Path parameters

  • idstringRequired

Body parameters

  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • memostring

    Credit note memo.

  • metadataobject

    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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

Returns

The credit_note object.

POST /v1/credit_notes/{id}
curl https://api.knoxapi.com/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  -d "metadata[order_id]=6735"
Response
{
  "amount": 1690,
  "amount_shipping": 0,
  "created": 1234567890,
  "currency": "usd",
  "customer": "cus_QXg1o8vcGmoR32",
  "customer_balance_transaction": null,
  "discount_amount": 0,
  "discount_amounts": [],
  "effective_at": 1234567890,
  "id": "cn_1Pgc75B7WZ01zgkWJMPt5riP",
  "invoice": "in_1Pgc75B7WZ01zgkWYv4iMwt7",
  "lines": {
    "data": [
      {
        "amount": 1190,
        "description": "My First Invoice Item (created for API docs)",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkWla6u0GdZ",
        "invoice_line_item": "il_1Pgc74B7WZ01zgkWWh45tUBA",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [
          {
            "active": true,
            "country": "DE",
            "created": 1721954066,
            "description": "VAT Germany",
            "display_name": "VAT",
            "effective_percentage": null,
            "id": "txr_1Pgc74B7WZ01zgkW94BlEhHU",
            "inclusive": false,
            "jurisdiction": "DE",
            "jurisdiction_level": null,
            "livemode": false,
            "metadata": {},
            "object": "tax_rate",
            "percentage": 19,
            "state": null,
            "tax_type": "vat",
            "flat_amount": {
              "amount": 1413853096,
              "currency": "currency"
            },
            "rate_type": null
          }
        ],
        "type": "invoice_line_item",
        "unit_amount": null,
        "unit_amount_decimal": null,
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      },
      {
        "amount": 500,
        "description": "Service credit",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkW9m0EaOVh",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [],
        "type": "custom_line_item",
        "unit_amount": 500,
        "unit_amount_decimal": "500",
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      }
    ],
    "has_more": false,
    "object": "list",
    "url": "/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/lines"
  },
  "livemode": false,
  "memo": null,
  "metadata": {},
  "number": "ABCD-1234-CN-01",
  "object": "credit_note",
  "out_of_band_amount": null,
  "pdf": "https://sangeekp-15t6ai--manage-mydev.dev.stripe.me/credit_notes/acct_1PgafTB7WZ01zgkW/cnst_123456789/pdf?s=ap",
  "shipping_cost": {
    "amount_subtotal": 1555417355,
    "amount_tax": 1424534716,
    "amount_total": 1117121693,
    "shipping_rate": null
  },
  "status": "issued",
  "subtotal": 1690,
  "subtotal_excluding_tax": 1690,
  "total": 1690,
  "total_excluding_tax": null,
  "type": "pre_payment",
  "voided_at": 1234567890,
  "pretax_credit_amounts": [
    {
      "amount": 1413853096,
      "type": "credit_balance_transaction"
    }
  ],
  "total_taxes": null,
  "refunds": [
    {
      "amount_refunded": 1387154914,
      "refund": "refund",
      "payment_record_refund": {
        "payment_record": "payment_record",
        "refund_group": "refund_group"
      },
      "type": null
    }
  ],
  "post_payment_amount": 1355257296,
  "pre_payment_amount": 251024947,
  "reason": null,
  "customer_account": null
}

Retrieve a credit note

GET/v1/credit_notes/{id}

Retrieves the credit note object with the given identifier.

Path parameters

  • idstringRequired

Query parameters

  • expandarray of strings

    Specifies which fields in the response should be expanded.

Returns

The credit_note object.

GET /v1/credit_notes/{id}
curl https://api.knoxapi.com/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP \
  -H "Authorization: Bearer $KNOX_SECRET_KEY"
Response
{
  "amount": 1690,
  "amount_shipping": 0,
  "created": 1234567890,
  "currency": "usd",
  "customer": "cus_QXg1o8vcGmoR32",
  "customer_balance_transaction": null,
  "discount_amount": 0,
  "discount_amounts": [],
  "effective_at": 1234567890,
  "id": "cn_1Pgc75B7WZ01zgkWJMPt5riP",
  "invoice": "in_1Pgc75B7WZ01zgkWYv4iMwt7",
  "lines": {
    "data": [
      {
        "amount": 1190,
        "description": "My First Invoice Item (created for API docs)",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkWla6u0GdZ",
        "invoice_line_item": "il_1Pgc74B7WZ01zgkWWh45tUBA",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [
          {
            "active": true,
            "country": "DE",
            "created": 1721954066,
            "description": "VAT Germany",
            "display_name": "VAT",
            "effective_percentage": null,
            "id": "txr_1Pgc74B7WZ01zgkW94BlEhHU",
            "inclusive": false,
            "jurisdiction": "DE",
            "jurisdiction_level": null,
            "livemode": false,
            "metadata": {},
            "object": "tax_rate",
            "percentage": 19,
            "state": null,
            "tax_type": "vat",
            "flat_amount": {
              "amount": 1413853096,
              "currency": "currency"
            },
            "rate_type": null
          }
        ],
        "type": "invoice_line_item",
        "unit_amount": null,
        "unit_amount_decimal": null,
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      },
      {
        "amount": 500,
        "description": "Service credit",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkW9m0EaOVh",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [],
        "type": "custom_line_item",
        "unit_amount": 500,
        "unit_amount_decimal": "500",
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      }
    ],
    "has_more": false,
    "object": "list",
    "url": "/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/lines"
  },
  "livemode": false,
  "memo": null,
  "metadata": {},
  "number": "ABCD-1234-CN-01",
  "object": "credit_note",
  "out_of_band_amount": null,
  "pdf": "https://sangeekp-15t6ai--manage-mydev.dev.stripe.me/credit_notes/acct_1PgafTB7WZ01zgkW/cnst_123456789/pdf?s=ap",
  "shipping_cost": {
    "amount_subtotal": 1555417355,
    "amount_tax": 1424534716,
    "amount_total": 1117121693,
    "shipping_rate": null
  },
  "status": "issued",
  "subtotal": 1690,
  "subtotal_excluding_tax": 1690,
  "total": 1690,
  "total_excluding_tax": null,
  "type": "pre_payment",
  "voided_at": 1234567890,
  "pretax_credit_amounts": [
    {
      "amount": 1413853096,
      "type": "credit_balance_transaction"
    }
  ],
  "total_taxes": null,
  "refunds": [
    {
      "amount_refunded": 1387154914,
      "refund": "refund",
      "payment_record_refund": {
        "payment_record": "payment_record",
        "refund_group": "refund_group"
      },
      "type": null
    }
  ],
  "post_payment_amount": 1355257296,
  "pre_payment_amount": 251024947,
  "reason": null,
  "customer_account": null
}

Retrieve a credit note preview's line items

GET/v1/credit_notes/preview/lines

When retrieving a credit note preview, you’ll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.

Query parameters

  • invoicestringRequired

    ID of the invoice.

  • amountinteger

    The integer amount in cents (or local equivalent) representing the total amount of the credit note. One of amount, lines, or shipping_cost must be provided.

  • credit_amountinteger

    The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.

  • effective_atinteger

    The date when this credit note is in effect. Same as created unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.

  • email_typestring

    Type of email to send to the customer, one of credit_note or none and the default is credit_note.

    Possible values
    • credit_note
    • none
  • ending_beforestring

    A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • limitinteger

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

  • linesarray of objects

    Line items that make up the credit note. One of amount, lines, or shipping_cost must be provided.

    Show 10 child parameters
    • typestringRequired
      Possible values
      • custom_line_item
      • invoice_line_item
    • amountinteger
    • descriptionstring
    • invoice_line_itemstring
    • metadataobject
    • quantityinteger
    • tax_amountsarray of objects
      Show 3 child parameters
      • amountintegerRequired
      • tax_ratestringRequired
      • taxable_amountintegerRequired
    • tax_ratesarray of strings
    • unit_amountinteger
    • unit_amount_decimalstring
  • memostring

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

  • metadataobject

    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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • out_of_band_amountinteger

    The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.

  • reasonstring

    Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory

    Possible values
    • duplicate
    • fraudulent
    • order_change
    • product_unsatisfactory
  • refund_amountinteger

    The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.

  • refundsarray of objects

    Refunds to link to this credit note.

    Show 4 child parameters
    • amount_refundedinteger
    • payment_record_refundobject
      Show 2 child parameters
      • payment_recordstringRequired
      • refund_groupstringRequired
    • refundstring
    • typestring
      Possible values
      • payment_record_refund
      • refund
  • shipping_costobject

    When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. One of amount, lines, or shipping_cost must be provided.

    Show 1 child parameter
    • shipping_ratestring
  • starting_afterstring

    A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

Returns

A list of credit_note_line_item objects.

GET /v1/credit_notes/preview/lines
curl -G https://api.knoxapi.com/v1/credit_notes/preview/lines \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  --data-urlencode invoice=in_1Pgc6tB7WZ01zgkWu9fdqL6I
Response
{
  "object": "list",
  "url": "/v1/credit_notes/preview/lines",
  "has_more": false,
  "data": [
    {
      "amount": 1000,
      "description": "My First Invoice Item (created for API docs)",
      "discount_amount": 0,
      "discount_amounts": [],
      "id": "cnli_1Pgc75B7WZ01zgkWPb1sOn7l",
      "invoice_line_item": "il_1Pgc75B7WZ01zgkWOwaRplc5",
      "livemode": false,
      "object": "credit_note_line_item",
      "quantity": 1,
      "tax_rates": [],
      "type": "invoice_line_item",
      "unit_amount": null,
      "unit_amount_decimal": null,
      "pretax_credit_amounts": [
        {
          "amount": 1413853096,
          "type": "credit_balance_transaction"
        }
      ],
      "taxes": null,
      "metadata": null
    }
  ]
}

Retrieve a credit note's line items

GET/v1/credit_notes/{credit_note}/lines

When retrieving a credit note, you’ll get a lines property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

Path parameters

  • credit_notestringRequired

Query parameters

  • ending_beforestring

    A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

  • expandarray of strings

    Specifies which fields in the response should be expanded.

  • limitinteger

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

  • starting_afterstring

    A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

Returns

A list of credit_note_line_item objects.

GET /v1/credit_notes/{credit_note}/lines
curl -G https://api.knoxapi.com/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/lines \
  -H "Authorization: Bearer $KNOX_SECRET_KEY" \
  --data-urlencode limit=3
Response
{
  "object": "list",
  "url": "/v1/credit_notes",
  "has_more": false,
  "data": [
    {
      "amount": 1000,
      "description": "My First Invoice Item (created for API docs)",
      "discount_amount": 0,
      "discount_amounts": [],
      "id": "cnli_1Pgc75B7WZ01zgkWPb1sOn7l",
      "invoice_line_item": "il_1Pgc75B7WZ01zgkWOwaRplc5",
      "livemode": false,
      "object": "credit_note_line_item",
      "quantity": 1,
      "tax_rates": [],
      "type": "invoice_line_item",
      "unit_amount": null,
      "unit_amount_decimal": null,
      "pretax_credit_amounts": [
        {
          "amount": 1413853096,
          "type": "credit_balance_transaction"
        }
      ],
      "taxes": null,
      "metadata": null
    }
  ]
}

Void a credit note

POST/v1/credit_notes/{id}/void

Marks a credit note as void. Learn more about voiding credit notes.

Path parameters

  • idstringRequired

Body parameters

  • expandarray of strings

    Specifies which fields in the response should be expanded.

Returns

The credit_note object.

POST /v1/credit_notes/{id}/void
curl -X POST https://api.knoxapi.com/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/void \
  -H "Authorization: Bearer $KNOX_SECRET_KEY"
Response
{
  "amount": 1690,
  "amount_shipping": 0,
  "created": 1234567890,
  "currency": "usd",
  "customer": "cus_QXg1o8vcGmoR32",
  "customer_balance_transaction": null,
  "discount_amount": 0,
  "discount_amounts": [],
  "effective_at": 1234567890,
  "id": "cn_1Pgc75B7WZ01zgkWJMPt5riP",
  "invoice": "in_1Pgc75B7WZ01zgkWYv4iMwt7",
  "lines": {
    "data": [
      {
        "amount": 1190,
        "description": "My First Invoice Item (created for API docs)",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkWla6u0GdZ",
        "invoice_line_item": "il_1Pgc74B7WZ01zgkWWh45tUBA",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [
          {
            "active": true,
            "country": "DE",
            "created": 1721954066,
            "description": "VAT Germany",
            "display_name": "VAT",
            "effective_percentage": null,
            "id": "txr_1Pgc74B7WZ01zgkW94BlEhHU",
            "inclusive": false,
            "jurisdiction": "DE",
            "jurisdiction_level": null,
            "livemode": false,
            "metadata": {},
            "object": "tax_rate",
            "percentage": 19,
            "state": null,
            "tax_type": "vat",
            "flat_amount": {
              "amount": 1413853096,
              "currency": "currency"
            },
            "rate_type": null
          }
        ],
        "type": "invoice_line_item",
        "unit_amount": null,
        "unit_amount_decimal": null,
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      },
      {
        "amount": 500,
        "description": "Service credit",
        "discount_amount": 0,
        "discount_amounts": [],
        "id": "cnli_1Pgc75B7WZ01zgkW9m0EaOVh",
        "livemode": false,
        "object": "credit_note_line_item",
        "quantity": 1,
        "tax_rates": [],
        "type": "custom_line_item",
        "unit_amount": 500,
        "unit_amount_decimal": "500",
        "pretax_credit_amounts": [
          {
            "amount": 1413853096,
            "type": "credit_balance_transaction"
          }
        ],
        "taxes": null,
        "metadata": null
      }
    ],
    "has_more": false,
    "object": "list",
    "url": "/v1/credit_notes/cn_1Pgc75B7WZ01zgkWJMPt5riP/lines"
  },
  "livemode": false,
  "memo": null,
  "metadata": {},
  "number": "ABCD-1234-CN-01",
  "object": "credit_note",
  "out_of_band_amount": null,
  "pdf": "https://sangeekp-15t6ai--manage-mydev.dev.stripe.me/credit_notes/acct_1PgafTB7WZ01zgkW/cnst_123456789/pdf?s=ap",
  "shipping_cost": {
    "amount_subtotal": 1555417355,
    "amount_tax": 1424534716,
    "amount_total": 1117121693,
    "shipping_rate": null
  },
  "status": "issued",
  "subtotal": 1690,
  "subtotal_excluding_tax": 1690,
  "total": 1690,
  "total_excluding_tax": null,
  "type": "pre_payment",
  "voided_at": 1234567890,
  "pretax_credit_amounts": [
    {
      "amount": 1413853096,
      "type": "credit_balance_transaction"
    }
  ],
  "total_taxes": null,
  "refunds": [
    {
      "amount_refunded": 1387154914,
      "refund": "refund",
      "payment_record_refund": {
        "payment_record": "payment_record",
        "refund_group": "refund_group"
      },
      "type": null
    }
  ],
  "post_payment_amount": 1355257296,
  "pre_payment_amount": 251024947,
  "reason": null,
  "customer_account": null
}

Operations and schemas come from the pinned Stripe OpenAPI specification (MIT); response examples from its fixtures. Nested object definitions and enums are in the complete specification.