# CreditNoteResponse

## Example Usage

```typescript
import { CreditNoteResponse } from "@flexprice/sdk/sdk/models";

let value: CreditNoteResponse = {
  invoice: {
    subscription: {
      couponAssociations: [
        {
          subscriptionLineItem: {
            price: {
              addon: {
                prices: [
                  {
                    addon: {},
                    meter: {
                      createdAt: new Date("2024-03-20T15:04:05Z"),
                      eventName: "api_request",
                      id: "550e8400-e29b-41d4-a716-446655440000",
                      name: "API Usage Meter",
                      status: "published",
                      tenantId: "tenant123",
                      updatedAt: new Date("2024-03-20T15:04:05Z"),
                    },
                    plan: {},
                  },
                ],
              },
              meter: {
                createdAt: new Date("2024-03-20T15:04:05Z"),
                eventName: "api_request",
                id: "550e8400-e29b-41d4-a716-446655440000",
                name: "API Usage Meter",
                status: "published",
                tenantId: "tenant123",
                updatedAt: new Date("2024-03-20T15:04:05Z"),
              },
              plan: {},
            },
          },
        },
      ],
      entitlements: [
        {
          feature: {
            meter: {
              createdAt: new Date("2024-03-20T15:04:05Z"),
              eventName: "api_request",
              id: "550e8400-e29b-41d4-a716-446655440000",
              name: "API Usage Meter",
              status: "published",
              tenantId: "tenant123",
              updatedAt: new Date("2024-03-20T15:04:05Z"),
            },
          },
        },
      ],
      latestInvoice: {
        subscription: {
          couponAssociations: [
            {
              subscriptionLineItem: {
                price: {
                  addon: {
                    prices: [
                      {
                        addon: {},
                        meter: {
                          createdAt: new Date("2024-03-20T15:04:05Z"),
                          eventName: "api_request",
                          id: "550e8400-e29b-41d4-a716-446655440000",
                          name: "API Usage Meter",
                          status: "published",
                          tenantId: "tenant123",
                          updatedAt: new Date("2024-03-20T15:04:05Z"),
                        },
                        plan: {},
                      },
                    ],
                  },
                  meter: {
                    createdAt: new Date("2024-03-20T15:04:05Z"),
                    eventName: "api_request",
                    id: "550e8400-e29b-41d4-a716-446655440000",
                    name: "API Usage Meter",
                    status: "published",
                    tenantId: "tenant123",
                    updatedAt: new Date("2024-03-20T15:04:05Z"),
                  },
                  plan: {},
                },
              },
            },
          ],
          entitlements: [
            {
              feature: {
                meter: {
                  createdAt: new Date("2024-03-20T15:04:05Z"),
                  eventName: "api_request",
                  id: "550e8400-e29b-41d4-a716-446655440000",
                  name: "API Usage Meter",
                  status: "published",
                  tenantId: "tenant123",
                  updatedAt: new Date("2024-03-20T15:04:05Z"),
                },
              },
            },
          ],
          plan: {},
        },
      },
      plan: {},
    },
  },
  subscription: {
    couponAssociations: [
      {
        subscriptionLineItem: {
          price: {
            addon: {
              prices: [
                {
                  addon: {},
                  meter: {
                    createdAt: new Date("2024-03-20T15:04:05Z"),
                    eventName: "api_request",
                    id: "550e8400-e29b-41d4-a716-446655440000",
                    name: "API Usage Meter",
                    status: "published",
                    tenantId: "tenant123",
                    updatedAt: new Date("2024-03-20T15:04:05Z"),
                  },
                  plan: {},
                },
              ],
            },
            meter: {
              createdAt: new Date("2024-03-20T15:04:05Z"),
              eventName: "api_request",
              id: "550e8400-e29b-41d4-a716-446655440000",
              name: "API Usage Meter",
              status: "published",
              tenantId: "tenant123",
              updatedAt: new Date("2024-03-20T15:04:05Z"),
            },
            plan: {},
          },
        },
      },
    ],
    entitlements: [
      {
        feature: {
          meter: {
            createdAt: new Date("2024-03-20T15:04:05Z"),
            eventName: "api_request",
            id: "550e8400-e29b-41d4-a716-446655440000",
            name: "API Usage Meter",
            status: "published",
            tenantId: "tenant123",
            updatedAt: new Date("2024-03-20T15:04:05Z"),
          },
        },
      },
    ],
    latestInvoice: {
      subscription: {
        couponAssociations: [
          {
            subscriptionLineItem: {
              price: {
                addon: {
                  prices: [
                    {
                      addon: {},
                      meter: {
                        createdAt: new Date("2024-03-20T15:04:05Z"),
                        eventName: "api_request",
                        id: "550e8400-e29b-41d4-a716-446655440000",
                        name: "API Usage Meter",
                        status: "published",
                        tenantId: "tenant123",
                        updatedAt: new Date("2024-03-20T15:04:05Z"),
                      },
                      plan: {},
                    },
                  ],
                },
                meter: {
                  createdAt: new Date("2024-03-20T15:04:05Z"),
                  eventName: "api_request",
                  id: "550e8400-e29b-41d4-a716-446655440000",
                  name: "API Usage Meter",
                  status: "published",
                  tenantId: "tenant123",
                  updatedAt: new Date("2024-03-20T15:04:05Z"),
                },
                plan: {},
              },
            },
          },
        ],
        entitlements: [
          {
            feature: {
              meter: {
                createdAt: new Date("2024-03-20T15:04:05Z"),
                eventName: "api_request",
                id: "550e8400-e29b-41d4-a716-446655440000",
                name: "API Usage Meter",
                status: "published",
                tenantId: "tenant123",
                updatedAt: new Date("2024-03-20T15:04:05Z"),
              },
            },
          },
        ],
        plan: {},
      },
    },
    plan: {},
  },
};
```

## Fields

| Field                                                                                             | Type                                                                                              | Required                                                                                          | Description                                                                                       |
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `createdAt`                                                                                       | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)     | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `createdBy`                                                                                       | *string*                                                                                          | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `creditNoteNumber`                                                                                | *string*                                                                                          | :heavy_minus_sign:                                                                                | credit_note_number is the unique identifier for credit notes                                      |
| `creditNoteStatus`                                                                                | [models.CreditNoteStatus](../../sdk/models/credit-note-status.md)                                 | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `creditNoteType`                                                                                  | [models.CreditNoteType](../../sdk/models/credit-note-type.md)                                     | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `currency`                                                                                        | *string*                                                                                          | :heavy_minus_sign:                                                                                | currency is the three-letter ISO currency code (e.g., USD, EUR) for the credit note               |
| `customer`                                                                                        | [models.Customer](../../sdk/models/customer.md)                                                   | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `customerId`                                                                                      | *string*                                                                                          | :heavy_minus_sign:                                                                                | customer_id is the unique identifier of the customer who owns this credit note                    |
| `environmentId`                                                                                   | *string*                                                                                          | :heavy_minus_sign:                                                                                | environment_id is the unique identifier of the environment this credit note belongs to            |
| `finalizedAt`                                                                                     | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)     | :heavy_minus_sign:                                                                                | finalized_at is the timestamp when the credit note was finalized                                  |
| `id`                                                                                              | *string*                                                                                          | :heavy_minus_sign:                                                                                | id is the unique identifier for the credit note                                                   |
| `idempotencyKey`                                                                                  | *string*                                                                                          | :heavy_minus_sign:                                                                                | idempotency_key is an optional key used to prevent duplicate credit note creation                 |
| `invoice`                                                                                         | [models.InvoiceResponse](../../sdk/models/invoice-response.md)                                    | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `invoiceId`                                                                                       | *string*                                                                                          | :heavy_minus_sign:                                                                                | invoice_id is the id of the invoice resource that this credit note is applied to                  |
| `lineItems`                                                                                       | [models.CreditnoteCreditNoteLineItem](../../sdk/models/creditnote-credit-note-line-item.md)[]     | :heavy_minus_sign:                                                                                | line_items contains all of the line items associated with this credit note                        |
| `memo`                                                                                            | *string*                                                                                          | :heavy_minus_sign:                                                                                | memo is an optional memo supplied on the credit note                                              |
| `metadata`                                                                                        | Record<string, *string*>                                                                          | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `reason`                                                                                          | [models.CreditNoteReason](../../sdk/models/credit-note-reason.md)                                 | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `refundStatus`                                                                                    | [models.PaymentStatus](../../sdk/models/payment-status.md)                                        | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `status`                                                                                          | [models.Status](../../sdk/models/status.md)                                                       | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `subscription`                                                                                    | [models.SubscriptionResponse](../../sdk/models/subscription-response.md)                          | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `subscriptionId`                                                                                  | *string*                                                                                          | :heavy_minus_sign:                                                                                | subscription_id is the optional unique identifier of the subscription related to this credit note |
| `tenantId`                                                                                        | *string*                                                                                          | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `totalAmount`                                                                                     | *string*                                                                                          | :heavy_minus_sign:                                                                                | total_amount is the total including creditable invoice-level discounts or minimums, and tax       |
| `updatedAt`                                                                                       | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)     | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `updatedBy`                                                                                       | *string*                                                                                          | :heavy_minus_sign:                                                                                | N/A                                                                                               |
| `voidedAt`                                                                                        | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)     | :heavy_minus_sign:                                                                                | voided_at is the timestamp when the credit note was voided                                        |