Skip to content

Latest commit

 

History

History
53 lines (47 loc) · 13.4 KB

customerstatesubscription.md

File metadata and controls

53 lines (47 loc) · 13.4 KB

CustomerStateSubscription

An active customer subscription.

Example Usage

import { CustomerStateSubscription } from "@polar-sh/sdk/models/components/customerstatesubscription.js";

let value: CustomerStateSubscription = {
  id: "e5149aae-e521-42b9-b24c-abb3d71eea2e",
  createdAt: new Date("2024-12-31T22:39:03.650Z"),
  modifiedAt: new Date("2025-01-04T13:00:17.295Z"),
  metadata: {
    "key": 823316,
  },
  amount: 1000,
  currency: "usd",
  recurringInterval: "month",
  currentPeriodStart: new Date("2025-02-03T13:37:00Z"),
  currentPeriodEnd: new Date("2025-03-03T13:37:00Z"),
  cancelAtPeriodEnd: false,
  canceledAt: null,
  startedAt: new Date("2025-01-03T13:37:00Z"),
  endsAt: null,
  productId: "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23",
  discountId: null,
  priceId: "196ca717-4d84-4d28-a1b8-777255797dbc",
};

Fields

Field Type Required Description Example
id string ✔️ The ID of the subscription. e5149aae-e521-42b9-b24c-abb3d71eea2e
createdAt Date ✔️ Creation timestamp of the object.
modifiedAt Date ✔️ Last modification timestamp of the object.
customFieldData Record<string, components.CustomerStateSubscriptionCustomFieldData> Key-value object storing custom field values.
metadata Record<string, components.CustomerStateSubscriptionMetadata> ✔️ N/A
status string ✔️ N/A active
amount number ✔️ The amount of the subscription. 1000
currency string ✔️ The currency of the subscription. usd
recurringInterval components.SubscriptionRecurringInterval ✔️ N/A
currentPeriodStart Date ✔️ The start timestamp of the current billing period. 2025-02-03T13:37:00Z
currentPeriodEnd Date ✔️ The end timestamp of the current billing period. 2025-03-03T13:37:00Z
cancelAtPeriodEnd boolean ✔️ Whether the subscription will be canceled at the end of the current period. false
canceledAt Date ✔️ The timestamp when the subscription was canceled. The subscription might still be active if cancel_at_period_end is true.
startedAt Date ✔️ The timestamp when the subscription started. 2025-01-03T13:37:00Z
endsAt Date ✔️ The timestamp when the subscription will end.
productId string ✔️ The ID of the subscribed product. d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23
discountId string ✔️ The ID of the applied discount, if any.
priceId string ✔️ : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. 196ca717-4d84-4d28-a1b8-777255797dbc