Skip to content

Latest commit

 

History

History
184 lines (179 loc) · 32.9 KB

order.md

File metadata and controls

184 lines (179 loc) · 32.9 KB

Order

Example Usage

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

let value: Order = {
  createdAt: new Date("2023-05-14T19:20:23.288Z"),
  modifiedAt: new Date("2023-10-12T12:31:28.351Z"),
  id: "<value>",
  metadata: {
    "key": "<value>",
  },
  status: "pending",
  paid: true,
  subtotalAmount: 132305,
  discountAmount: 193236,
  netAmount: 685467,
  amount: 49499,
  taxAmount: 101854,
  totalAmount: 134173,
  refundedAmount: 316541,
  refundedTaxAmount: 298750,
  currency: "Nakfa",
  billingReason: "subscription_update",
  billingAddress: {
    country: "FR",
  },
  customerId: "<value>",
  productId: "<value>",
  productPriceId: "<value>",
  discountId: "<value>",
  subscriptionId: "<value>",
  checkoutId: "<value>",
  customer: {
    id: "992fae2a-2a17-4b7a-8d9e-e287cf90131b",
    createdAt: new Date("2024-08-08T05:45:19.091Z"),
    modifiedAt: new Date("2025-10-31T20:18:29.852Z"),
    metadata: {
      "key": 106682,
    },
    externalId: "usr_1337",
    email: "[email protected]",
    emailVerified: true,
    name: "John Doe",
    billingAddress: {
      country: "SE",
    },
    taxId: [
      "911144442",
      "us_ein",
    ],
    organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
    deletedAt: new Date("2024-06-24T18:34:36.250Z"),
    avatarUrl: "https://www.gravatar.com/avatar/xxx?d=blank",
  },
  userId: "<value>",
  user: {
    id: "<value>",
    email: "[email protected]",
    publicName: "<value>",
  },
  product: {
    createdAt: new Date("2024-03-11T03:02:50.967Z"),
    modifiedAt: new Date("2025-02-11T00:34:41.133Z"),
    id: "<value>",
    name: "<value>",
    description: "lock warm remarkable institutionalize gosh",
    recurringInterval: "month",
    isRecurring: false,
    isArchived: false,
    organizationId: "<value>",
  },
  productPrice: {
    createdAt: new Date("2025-11-14T08:56:10.067Z"),
    modifiedAt: new Date("2025-01-01T05:12:31.175Z"),
    id: "<value>",
    isArchived: false,
    productId: "<value>",
    recurringInterval: "year",
    priceCurrency: "<value>",
    minimumAmount: 531494,
    maximumAmount: 802069,
    presetAmount: 374414,
  },
  discount: {
    duration: "forever",
    durationInMonths: 657862,
    type: "fixed",
    amount: 900368,
    currency: "Namibia Dollar",
    createdAt: new Date("2023-02-03T08:20:20.613Z"),
    modifiedAt: new Date("2023-08-01T05:04:01.310Z"),
    id: "<value>",
    metadata: {
      "key": "<value>",
    },
    name: "<value>",
    code: "<value>",
    startsAt: new Date("2023-02-16T10:20:38.020Z"),
    endsAt: new Date("2023-09-07T14:29:56.720Z"),
    maxRedemptions: 446793,
    redemptionsCount: 836991,
    organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
  },
  subscription: {
    metadata: {
      "key": "<value>",
    },
    createdAt: new Date("2024-06-25T08:44:09.618Z"),
    modifiedAt: new Date("2025-10-15T20:41:28.761Z"),
    id: "<value>",
    amount: 667215,
    currency: "South Sudanese pound",
    recurringInterval: "year",
    status: "unpaid",
    currentPeriodStart: new Date("2024-10-07T04:10:09.540Z"),
    currentPeriodEnd: new Date("2023-02-19T21:06:49.752Z"),
    cancelAtPeriodEnd: false,
    canceledAt: new Date("2023-08-05T23:44:22.450Z"),
    startedAt: new Date("2024-03-19T15:09:55.930Z"),
    endsAt: new Date("2024-10-20T23:59:41.091Z"),
    endedAt: new Date("2025-04-26T00:52:10.331Z"),
    customerId: "<value>",
    productId: "<value>",
    discountId: "<value>",
    checkoutId: "<value>",
    customerCancellationReason: "switched_service",
    customerCancellationComment: "<value>",
    priceId: "<value>",
    userId: "<value>",
  },
  items: [
    {
      createdAt: new Date("2025-02-17T05:22:25.159Z"),
      modifiedAt: new Date("2025-05-15T16:43:38.676Z"),
      id: "<value>",
      label: "<value>",
      amount: 317260,
      taxAmount: 979271,
      proration: false,
      productPriceId: "<value>",
    },
  ],
};

Fields

Field Type Required Description Example
createdAt Date ✔️ Creation timestamp of the object.
modifiedAt Date ✔️ Last modification timestamp of the object.
id string ✔️ The ID of the object.
metadata Record<string, components.OrderMetadata> ✔️ N/A
customFieldData Record<string, components.OrderCustomFieldData> Key-value object storing custom field values.
status components.OrderStatus ✔️ N/A
paid boolean ✔️ Whether the order has been paid for. true
subtotalAmount number ✔️ Amount in cents, before discounts and taxes.
discountAmount number ✔️ Discount amount in cents.
netAmount number ✔️ Amount in cents, after discounts but before taxes.
amount number ✔️ : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Amount in cents, after discounts but before taxes.
taxAmount number ✔️ Sales tax amount in cents.
totalAmount number ✔️ Amount in cents, after discounts and taxes.
refundedAmount number ✔️ Amount refunded in cents.
refundedTaxAmount number ✔️ Sales tax refunded in cents.
currency string ✔️ N/A
billingReason components.OrderBillingReason ✔️ N/A
billingAddress components.Address ✔️ N/A
customerId string ✔️ N/A
productId string ✔️ N/A
productPriceId string ✔️ : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
discountId string ✔️ N/A
subscriptionId string ✔️ N/A
checkoutId string ✔️ N/A
customer components.OrderCustomer ✔️ N/A
userId string ✔️ : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
user components.OrderUser ✔️ N/A
product components.OrderProduct ✔️ N/A
productPrice components.OrderProductPrice ✔️ : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
discount components.OrderDiscount ✔️ N/A
subscription components.OrderSubscription ✔️ N/A
items components.OrderItemSchema[] ✔️ Line items composing the order.