import * as z from "zod/v4-mini"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomerCancellationReason } from "./customercancellationreason.js"; import { DiscountFixedOnceForeverDurationBase, DiscountFixedOnceForeverDurationBase$Outbound } from "./discountfixedonceforeverdurationbase.js"; import { DiscountFixedRepeatDurationBase, DiscountFixedRepeatDurationBase$Outbound } from "./discountfixedrepeatdurationbase.js"; import { DiscountPercentageOnceForeverDurationBase, DiscountPercentageOnceForeverDurationBase$Outbound } from "./discountpercentageonceforeverdurationbase.js"; import { DiscountPercentageRepeatDurationBase, DiscountPercentageRepeatDurationBase$Outbound } from "./discountpercentagerepeatdurationbase.js"; import { LegacyRecurringProductPrice, LegacyRecurringProductPrice$Outbound } from "./legacyrecurringproductprice.js"; import { MetadataOutputType, MetadataOutputType$Outbound } from "./metadataoutputtype.js"; import { PendingSubscriptionUpdate, PendingSubscriptionUpdate$Outbound } from "./pendingsubscriptionupdate.js"; import { Product, Product$Outbound } from "./product.js"; import { ProductPrice, ProductPrice$Outbound } from "./productprice.js"; import { SubscriptionCustomer, SubscriptionCustomer$Outbound } from "./subscriptioncustomer.js"; import { SubscriptionMeter, SubscriptionMeter$Outbound } from "./subscriptionmeter.js"; import { SubscriptionRecurringInterval } from "./subscriptionrecurringinterval.js"; import { SubscriptionStatus } from "./subscriptionstatus.js"; export type CustomFieldData = string | number | boolean | Date; export type SubscriptionDiscount = DiscountFixedRepeatDurationBase | DiscountFixedOnceForeverDurationBase | DiscountPercentageRepeatDurationBase | DiscountPercentageOnceForeverDurationBase; export type SubscriptionPrices = LegacyRecurringProductPrice | ProductPrice; export type Subscription = { /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * The ID of the object. */ id: string; /** * The amount of the subscription. */ amount: number; /** * The currency of the subscription. */ currency: string; recurringInterval: SubscriptionRecurringInterval; /** * Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. */ recurringIntervalCount: number; status: SubscriptionStatus; /** * The start timestamp of the current billing period. */ currentPeriodStart: Date; /** * The end timestamp of the current billing period. */ currentPeriodEnd: Date; /** * The start timestamp of the trial period, if any. */ trialStart: Date | null; /** * The end timestamp of the trial period, if any. */ trialEnd: Date | null; /** * Whether the subscription will be canceled at the end of the current period. */ cancelAtPeriodEnd: boolean; /** * The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`. */ canceledAt: Date | null; /** * The timestamp when the subscription started. */ startedAt: Date | null; /** * The timestamp when the subscription will end. */ endsAt: Date | null; /** * The timestamp when the subscription ended. */ endedAt: Date | null; /** * The ID of the subscribed customer. */ customerId: string; /** * The ID of the subscribed product. */ productId: string; /** * The ID of the applied discount, if any. */ discountId: string | null; checkoutId: string | null; /** * The number of seats for seat-based subscriptions. None for non-seat subscriptions. */ seats?: number | null | undefined; customerCancellationReason: CustomerCancellationReason | null; customerCancellationComment: string | null; metadata: { [k: string]: MetadataOutputType; }; /** * Key-value object storing custom field values. */ customFieldData?: { [k: string]: string | number | boolean | Date | null; } | undefined; customer: SubscriptionCustomer; /** * A product. */ product: Product; discount: DiscountFixedRepeatDurationBase | DiscountFixedOnceForeverDurationBase | DiscountPercentageRepeatDurationBase | DiscountPercentageOnceForeverDurationBase | null; /** * List of enabled prices for the subscription. */ prices: Array; /** * List of meters associated with the subscription. */ meters: Array; /** * Pending subscription update that will be applied at the beginning of the next period. If `null`, there is no pending update. */ pendingUpdate: PendingSubscriptionUpdate | null; }; /** @internal */ export declare const CustomFieldData$inboundSchema: z.ZodMiniType; /** @internal */ export type CustomFieldData$Outbound = string | number | boolean | string; /** @internal */ export declare const CustomFieldData$outboundSchema: z.ZodMiniType; export declare function customFieldDataToJSON(customFieldData: CustomFieldData): string; export declare function customFieldDataFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const SubscriptionDiscount$inboundSchema: z.ZodMiniType; /** @internal */ export type SubscriptionDiscount$Outbound = DiscountFixedRepeatDurationBase$Outbound | DiscountFixedOnceForeverDurationBase$Outbound | DiscountPercentageRepeatDurationBase$Outbound | DiscountPercentageOnceForeverDurationBase$Outbound; /** @internal */ export declare const SubscriptionDiscount$outboundSchema: z.ZodMiniType; export declare function subscriptionDiscountToJSON(subscriptionDiscount: SubscriptionDiscount): string; export declare function subscriptionDiscountFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const SubscriptionPrices$inboundSchema: z.ZodMiniType; /** @internal */ export type SubscriptionPrices$Outbound = LegacyRecurringProductPrice$Outbound | ProductPrice$Outbound; /** @internal */ export declare const SubscriptionPrices$outboundSchema: z.ZodMiniType; export declare function subscriptionPricesToJSON(subscriptionPrices: SubscriptionPrices): string; export declare function subscriptionPricesFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Subscription$inboundSchema: z.ZodMiniType; /** @internal */ export type Subscription$Outbound = { created_at: string; modified_at: string | null; id: string; amount: number; currency: string; recurring_interval: string; recurring_interval_count: number; status: string; current_period_start: string; current_period_end: string; trial_start: string | null; trial_end: string | null; cancel_at_period_end: boolean; canceled_at: string | null; started_at: string | null; ends_at: string | null; ended_at: string | null; customer_id: string; product_id: string; discount_id: string | null; checkout_id: string | null; seats?: number | null | undefined; customer_cancellation_reason: string | null; customer_cancellation_comment: string | null; metadata: { [k: string]: MetadataOutputType$Outbound; }; custom_field_data?: { [k: string]: string | number | boolean | string | null; } | undefined; customer: SubscriptionCustomer$Outbound; product: Product$Outbound; discount: DiscountFixedRepeatDurationBase$Outbound | DiscountFixedOnceForeverDurationBase$Outbound | DiscountPercentageRepeatDurationBase$Outbound | DiscountPercentageOnceForeverDurationBase$Outbound | null; prices: Array; meters: Array; pending_update: PendingSubscriptionUpdate$Outbound | null; }; /** @internal */ export declare const Subscription$outboundSchema: z.ZodMiniType; export declare function subscriptionToJSON(subscription: Subscription): string; export declare function subscriptionFromJSON(jsonString: string): SafeParseResult; //# sourceMappingURL=subscription.d.ts.map