code: import stripe
  stripe.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
  
  stripe.CreditNote.preview(
    invoice="in_1LSdb92eZvKYlo2CJvl4iJuW",
    lines=[
      {
        "type": "invoice_line_item",
        "invoice_line_item":
        "il_1LSdb92eZvKYlo2Cg5Kr2nEp",
        "quantity": 1,
      },
    ],
  )
  '''Response {
    "id": "cn_1LSdb92eZvKYlo2C0JdIQVHd",
    "object": "credit_note",
    "amount": 857,
    "created": 1659517839,
    "currency": "usd",
    "customer": "cus_8TEMHVY5moxIPI",
    "customer_balance_transaction": null,
    "discount_amount": 0,
    "discount_amounts": [],
    "invoice": "in_1LSdb92eZvKYlo2CJvl4iJuW",
    "lines": {
      "object": "list",
      "data": [
        {
          "id": "cnli_1LSdb92eZvKYlo2Cu4lDIS7X",
          "object": "credit_note_line_item",
          "amount": 357,
          "amount_excluding_tax": 357,
          "description": "My First Invoice Item (created for API docs)",
          "discount_amount": 0,
          "discount_amounts": [],
          "invoice_line_item": "il_1LSdb92eZvKYlo2Cg5Kr2nEp",
          "livemode": false,
          "quantity": 1,
          "tax_amounts": [
            {
              "amount": 57,
              "inclusive": false,
              "tax_rate": "txr_1LSdb92eZvKYlo2CboQRs5G6"
            }
          ],
          "tax_rates": [
            {
              "id": "txr_1LSdb92eZvKYlo2CboQRs5G6",
              "object": "tax_rate",
              "active": true,
              "country": "DE",
              "created": 1659517839,
              "description": "VAT Germany",
              "display_name": "VAT",
              "inclusive": false,
              "jurisdiction": "DE",
              "livemode": false,
              "metadata": {},
              "percentage": 19.0,
              "state": null,
              "tax_type": "vat"
            }
          ],
          "type": "invoice_line_item",
          "unit_amount": null,
          "unit_amount_decimal": null,
          "unit_amount_excluding_tax": "357"
        },
        {
          "id": "cnli_1LSdb92eZvKYlo2C9yhKwMbp",
          "object": "credit_note_line_item",
          "amount": 500,
          "amount_excluding_tax": 500,
          "description": "Service credit",
          "discount_amount": 0,
          "discount_amounts": [],
          "livemode": false,
          "quantity": 1,
          "tax_amounts": [],
          "tax_rates": [],
          "type": "custom_line_item",
          "unit_amount": 500,
          "unit_amount_decimal": "500",
          "unit_amount_excluding_tax": "500"
        }
      ],
      "has_more": false,
      "url": "/v1/credit_notes/cn_1LSdb92eZvKYlo2C0JdIQVHd/lines"
    },
    "livemode": false,
    "memo": null,
    "metadata": {},
    "number": "ABCD-1234-CN-01",
    "out_of_band_amount": null,
    "pdf": "https://pay.stripe.com/credit_notes/acct_1032D82eZvKYlo2C/cnst_123456789/pdf?s=ap",
    "reason": null,
    "refund": null,
    "status": "issued",
    "subtotal": 857,
    "subtotal_excluding_tax": 857,
    "tax_amounts": [
      {
        "amount": 57,
        "inclusive": false,
        "tax_rate": "txr_1LSdb92eZvKYlo2CboQRs5G6"
      }
    ],
    "total": 857,
    "total_excluding_tax": null,
    "type": "pre_payment",
    "voided_at": null
  }'''
nl: Preview a credit noteGet a preview of a credit note without creating it.Parameters invoice required ID of the invoice. lines optional array of hashes Line items that make up the credit note.Show child parameters memo optional The credit note’s memo appears on the credit note PDF. metadata optional dictionary 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. reason optional Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactoryMore parametersExpand all  amount optional   credit_amount optional   out_of_band_amount optional   refund optional   refund_amount optional ReturnsReturns a credit note object