import * as z from "zod/v4-mini"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$Outbound } from "./address.js"; import { AttachedCustomField, AttachedCustomField$Outbound } from "./attachedcustomfield.js"; import { CheckoutBillingAddressFields, CheckoutBillingAddressFields$Outbound } from "./checkoutbillingaddressfields.js"; import { CheckoutDiscountFixedOnceForeverDuration, CheckoutDiscountFixedOnceForeverDuration$Outbound } from "./checkoutdiscountfixedonceforeverduration.js"; import { CheckoutDiscountFixedRepeatDuration, CheckoutDiscountFixedRepeatDuration$Outbound } from "./checkoutdiscountfixedrepeatduration.js"; import { CheckoutDiscountPercentageOnceForeverDuration, CheckoutDiscountPercentageOnceForeverDuration$Outbound } from "./checkoutdiscountpercentageonceforeverduration.js"; import { CheckoutDiscountPercentageRepeatDuration, CheckoutDiscountPercentageRepeatDuration$Outbound } from "./checkoutdiscountpercentagerepeatduration.js"; import { CheckoutProduct, CheckoutProduct$Outbound } from "./checkoutproduct.js"; import { CheckoutStatus } from "./checkoutstatus.js"; import { LegacyRecurringProductPrice, LegacyRecurringProductPrice$Outbound } from "./legacyrecurringproductprice.js"; import { MetadataOutputType, MetadataOutputType$Outbound } from "./metadataoutputtype.js"; import { PaymentProcessor } from "./paymentprocessor.js"; import { ProductPrice, ProductPrice$Outbound } from "./productprice.js"; import { TaxBehavior } from "./taxbehavior.js"; import { TrialInterval } from "./trialinterval.js"; export type CheckoutCustomFieldData = string | number | boolean | Date; export type CheckoutProductPrice = LegacyRecurringProductPrice | ProductPrice; export type CheckoutPrices = LegacyRecurringProductPrice | ProductPrice; export type CheckoutDiscount = CheckoutDiscountFixedRepeatDuration | CheckoutDiscountFixedOnceForeverDuration | CheckoutDiscountPercentageRepeatDuration | CheckoutDiscountPercentageOnceForeverDuration; export type CustomerMetadata = string | number | boolean; /** * Checkout session data retrieved using an access token. */ export type Checkout = { /** * The ID of the object. */ id: string; /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * Key-value object storing custom field values. */ customFieldData?: { [k: string]: string | number | boolean | Date | null; } | undefined; paymentProcessor: PaymentProcessor; status: CheckoutStatus; /** * Client secret used to update and complete the checkout session from the client. */ clientSecret: string; /** * URL where the customer can access the checkout session. */ url: string; /** * Expiration date and time of the checkout session. */ expiresAt: Date; /** * URL where the customer will be redirected after a successful payment. */ successUrl: string; /** * When set, a back button will be shown in the checkout to return to this URL. */ returnUrl: string | null; /** * When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page. */ embedOrigin: string | null; /** * Amount in cents, before discounts and taxes. */ amount: number; /** * Predefined number of seats (works with seat-based pricing only) */ seats?: number | null | undefined; /** * Minimum number of seats (works with seat-based pricing only) */ minSeats?: number | null | undefined; /** * Maximum number of seats (works with seat-based pricing only) */ maxSeats?: number | null | undefined; /** * Discount amount in cents. */ discountAmount: number; /** * Amount in cents, after discounts but before taxes. */ netAmount: number; /** * Sales tax amount in cents. If `null`, it means there is no enough information yet to calculate it. */ taxAmount: number | null; /** * Tax behavior of the checkout. `inclusive` means the price includes tax, `exclusive` means tax is added on top. If `null`, tax is not yet calculated. */ taxBehavior: TaxBehavior | null; /** * Amount in cents, after discounts and taxes. */ totalAmount: number; /** * Currency code of the checkout session. */ currency: string; /** * Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured. */ allowTrial: boolean | null; /** * Interval unit of the trial period, if any. This value is either set from the checkout, if `trial_interval` is set, or from the selected product. */ activeTrialInterval: TrialInterval | null; /** * Number of interval units of the trial period, if any. This value is either set from the checkout, if `trial_interval_count` is set, or from the selected product. */ activeTrialIntervalCount: number | null; /** * End date and time of the trial period, if any. */ trialEnd: Date | null; /** * ID of the organization owning the checkout session. */ organizationId: string; /** * ID of the product to checkout. */ productId: string | null; /** * ID of the product price to checkout. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ productPriceId: string | null; /** * ID of the discount applied to the checkout. */ discountId: string | null; /** * Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it. */ allowDiscountCodes: boolean; /** * Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`. */ requireBillingAddress: boolean; /** * Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable. */ isDiscountApplicable: boolean; /** * Whether the product price is free, regardless of discounts. */ isFreeProductPrice: boolean; /** * Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount. */ isPaymentRequired: boolean; /** * Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles. */ isPaymentSetupRequired: boolean; /** * Whether the checkout requires a payment form, whether because of a payment or payment method setup. */ isPaymentFormRequired: boolean; customerId: string | null; /** * Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name. */ isBusinessCustomer: boolean; /** * Name of the customer. */ customerName: string | null; /** * Email address of the customer. */ customerEmail: string | null; customerIpAddress: string | null; customerBillingName: string | null; customerBillingAddress: Address | null; customerTaxId: string | null; locale?: string | null | undefined; paymentProcessorMetadata: { [k: string]: string; }; billingAddressFields: CheckoutBillingAddressFields; /** * The interval unit for the trial period. */ trialInterval: TrialInterval | null; /** * The number of interval units for the trial period. */ trialIntervalCount: number | null; metadata: { [k: string]: MetadataOutputType; }; /** * ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set. */ externalCustomerId: string | null; /** * List of products available to select. */ products: Array; /** * Product selected to checkout. */ product: CheckoutProduct | null; /** * Price of the selected product. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ productPrice: LegacyRecurringProductPrice | ProductPrice | null; /** * Mapping of product IDs to their list of prices. */ prices: { [k: string]: Array; } | null; discount: CheckoutDiscountFixedRepeatDuration | CheckoutDiscountFixedOnceForeverDuration | CheckoutDiscountPercentageRepeatDuration | CheckoutDiscountPercentageOnceForeverDuration | null; subscriptionId: string | null; attachedCustomFields: Array | null; customerMetadata: { [k: string]: string | number | boolean; }; }; /** @internal */ export declare const CheckoutCustomFieldData$inboundSchema: z.ZodMiniType; /** @internal */ export type CheckoutCustomFieldData$Outbound = string | number | boolean | string; /** @internal */ export declare const CheckoutCustomFieldData$outboundSchema: z.ZodMiniType; export declare function checkoutCustomFieldDataToJSON(checkoutCustomFieldData: CheckoutCustomFieldData): string; export declare function checkoutCustomFieldDataFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const CheckoutProductPrice$inboundSchema: z.ZodMiniType; /** @internal */ export type CheckoutProductPrice$Outbound = LegacyRecurringProductPrice$Outbound | ProductPrice$Outbound; /** @internal */ export declare const CheckoutProductPrice$outboundSchema: z.ZodMiniType; export declare function checkoutProductPriceToJSON(checkoutProductPrice: CheckoutProductPrice): string; export declare function checkoutProductPriceFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const CheckoutPrices$inboundSchema: z.ZodMiniType; /** @internal */ export type CheckoutPrices$Outbound = LegacyRecurringProductPrice$Outbound | ProductPrice$Outbound; /** @internal */ export declare const CheckoutPrices$outboundSchema: z.ZodMiniType; export declare function checkoutPricesToJSON(checkoutPrices: CheckoutPrices): string; export declare function checkoutPricesFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const CheckoutDiscount$inboundSchema: z.ZodMiniType; /** @internal */ export type CheckoutDiscount$Outbound = CheckoutDiscountFixedRepeatDuration$Outbound | CheckoutDiscountFixedOnceForeverDuration$Outbound | CheckoutDiscountPercentageRepeatDuration$Outbound | CheckoutDiscountPercentageOnceForeverDuration$Outbound; /** @internal */ export declare const CheckoutDiscount$outboundSchema: z.ZodMiniType; export declare function checkoutDiscountToJSON(checkoutDiscount: CheckoutDiscount): string; export declare function checkoutDiscountFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const CustomerMetadata$inboundSchema: z.ZodMiniType; /** @internal */ export type CustomerMetadata$Outbound = string | number | boolean; /** @internal */ export declare const CustomerMetadata$outboundSchema: z.ZodMiniType; export declare function customerMetadataToJSON(customerMetadata: CustomerMetadata): string; export declare function customerMetadataFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Checkout$inboundSchema: z.ZodMiniType; /** @internal */ export type Checkout$Outbound = { id: string; created_at: string; modified_at: string | null; custom_field_data?: { [k: string]: string | number | boolean | string | null; } | undefined; payment_processor: string; status: string; client_secret: string; url: string; expires_at: string; success_url: string; return_url: string | null; embed_origin: string | null; amount: number; seats?: number | null | undefined; min_seats?: number | null | undefined; max_seats?: number | null | undefined; discount_amount: number; net_amount: number; tax_amount: number | null; tax_behavior: string | null; total_amount: number; currency: string; allow_trial: boolean | null; active_trial_interval: string | null; active_trial_interval_count: number | null; trial_end: string | null; organization_id: string; product_id: string | null; product_price_id: string | null; discount_id: string | null; allow_discount_codes: boolean; require_billing_address: boolean; is_discount_applicable: boolean; is_free_product_price: boolean; is_payment_required: boolean; is_payment_setup_required: boolean; is_payment_form_required: boolean; customer_id: string | null; is_business_customer: boolean; customer_name: string | null; customer_email: string | null; customer_ip_address: string | null; customer_billing_name: string | null; customer_billing_address: Address$Outbound | null; customer_tax_id: string | null; locale?: string | null | undefined; payment_processor_metadata: { [k: string]: string; }; billing_address_fields: CheckoutBillingAddressFields$Outbound; trial_interval: string | null; trial_interval_count: number | null; metadata: { [k: string]: MetadataOutputType$Outbound; }; external_customer_id: string | null; products: Array; product: CheckoutProduct$Outbound | null; product_price: LegacyRecurringProductPrice$Outbound | ProductPrice$Outbound | null; prices: { [k: string]: Array; } | null; discount: CheckoutDiscountFixedRepeatDuration$Outbound | CheckoutDiscountFixedOnceForeverDuration$Outbound | CheckoutDiscountPercentageRepeatDuration$Outbound | CheckoutDiscountPercentageOnceForeverDuration$Outbound | null; subscription_id: string | null; attached_custom_fields: Array | null; customer_metadata: { [k: string]: string | number | boolean; }; }; /** @internal */ export declare const Checkout$outboundSchema: z.ZodMiniType; export declare function checkoutToJSON(checkout: Checkout): string; export declare function checkoutFromJSON(jsonString: string): SafeParseResult; //# sourceMappingURL=checkout.d.ts.map