import { GenerateCheckoutSessionRequest as GenerateCheckoutSessionRequest$1, GenerateCheckoutSessionResponse as GenerateCheckoutSessionResponse$1 } from './index.typings.js'; import '@wix/sdk-types'; /** A Wix-hosted checkout page generated for a specific set of line items. */ interface CheckoutSession { /** * Checkout session ID. * @readonly * @format GUID */ id?: string | null; /** * URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page * as an anonymous shopper, and any session held by the calling app isn't carried over. * * The URL carries query parameters Wix needs to render the page correctly (for example, a * `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the * buyer unchanged. Don't strip, reorder, rewrite, or otherwise mutate its query string. * @readonly * @format WEB_URL */ redirectUrl?: string | null; } /** Request to create a checkout session. */ interface GenerateCheckoutSessionRequest { /** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */ cart: Cart; /** URLs the buyer is redirected to after completing or leaving the checkout flow. */ callbackUrls: CallbackUrls; } /** * Recurring subscription configuration for a line item. * * `LineItem.name` and `subscriptionInfo.title`/`description` render in different parts of the * Wix-hosted checkout page: `LineItem.name` is the line label in the cart-summary list, while * `subscriptionInfo.title` and `subscriptionInfo.description` are the heading and body text on the * recurring-billing summary block (the area that shows the buyer the cadence and the free-trial terms, * if any). Set them to complementary values rather than duplicating `LineItem.name`. */ interface SubscriptionInfo { /** * Billing frequency, cycles, and free trial configuration. Required when `subscriptionInfo` is set on a * line item. */ subscriptionSettings?: SubscriptionSettings; /** * Subscription name shown to the buyer in the recurring-billing summary block on the Wix-hosted * checkout page (the heading of that block). * @maxLength 150 */ title?: string | null; /** * Subscription description shown to the buyer in the recurring-billing summary block on the * Wix-hosted checkout page (the body text below the title). * @maxLength 500 */ description?: string | null; } /** * Configuration for recurring subscription charges. * * `autoRenewal` and `billingCycles` are mutually exclusive. `autoRenewal: true` describes an * open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term * subscription that stops after N charges. Setting `autoRenewal: true` together with any * `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code * `AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT`). */ interface SubscriptionSettings { /** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */ frequency?: SubscriptionFrequencyWithLiterals; /** * Number of frequency units between charges. For `DAY` frequency, the minimum is 7. The shortest * billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with * `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`. * * Note that `freeTrialPeriod.interval` doesn't share this floor: a `DAY` trial may have * `interval` as low as 1. * @min 1 * @max 3650 */ interval?: number | null; /** * Whether the subscription renews automatically. Can't be `true` when `billingCycles` is set. * * Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles` * is set and `autoRenewal` is omitted. */ autoRenewal?: boolean | null; /** * Number of billing cycles before the subscription stops. Can't be set when `autoRenewal` is `true`. * * When omitted along with `autoRenewal`, the subscription renews indefinitely. * @min 1 */ billingCycles?: number | null; /** Free trial period before the first charge. */ freeTrialPeriod?: FreeTrialPeriod; } /** Frequency unit for subscription billing and trial periods. */ declare enum SubscriptionFrequency { /** Unknown frequency. */ UNDEFINED = "UNDEFINED", DAY = "DAY", WEEK = "WEEK", MONTH = "MONTH", YEAR = "YEAR" } /** @enumType */ type SubscriptionFrequencyWithLiterals = SubscriptionFrequency | 'UNDEFINED' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR'; /** * Free trial period before the first subscription charge. * * The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it * describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A * `frequency: MONTH` + `interval: 3` trial means "a single 3-month trial," not "billed every 3 * months." */ interface FreeTrialPeriod { /** * Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be * treated as a client mistake and isn't a valid runtime value. */ frequency?: SubscriptionFrequencyWithLiterals; /** * Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY` * gives a 14-day trial. * * Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1`. No weekly floor applies * to the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code * `MIN_VALUE`). * @min 1 * @max 999 */ interval?: number; } interface PhysicalProperties { /** Whether the item requires shipping. */ shippable?: boolean | null; } interface LineItem { /** * Name of the item, shown on the checkout page. * @minLength 1 * @maxLength 255 */ name?: string | null; /** * Quantity of this item to charge for. * @min 1 */ quantity?: number | null; /** * Per-unit price as a decimal string in the merchant account currency. For example, `"19.99"`. * @minLength 1 * @maxLength 50 */ price?: string | null; /** * Subscription configuration. When set, the line item follows a scheduled-billing model defined by * `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing * cycle is `price × quantity`, and `quantity` is locked at session creation. * * At most 1 line item per request may set `subscriptionInfo`. Wix rejects requests with 2 or more * subscription line items with `MULTIPLE_SUBSCRIPTION_ITEMS`. */ subscriptionInfo?: SubscriptionInfo; /** Optional. Physical properties of the item, used when the item requires shipping. */ physicalProperties?: PhysicalProperties; } /** * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the * Wix checkout page. */ interface CustomerInfo { /** * Buyer's first name. * @maxLength 100 */ firstName?: string | null; /** * Buyer's last name. * @maxLength 100 */ lastName?: string | null; /** * Buyer's phone number. * @format PHONE */ phone?: string | null; /** * Buyer's email address. * @format EMAIL */ email?: string | null; } /** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */ interface Cart { /** * Line items the buyer is paying for in this checkout session. * * At most 1 subscription line item (an item with `subscriptionInfo` set) is allowed per request. * Wix rejects requests with 2 or more subscription items. Non-recurring items can be combined with a * single subscription item. In that case the buyer is charged once at checkout for the non-recurring * items and, if applicable, the first cycle of the subscription. Wix bills any subsequent cycles on * the subscription's own schedule. * @maxSize 100 */ items?: LineItem[]; /** * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the * Wix checkout page. */ customerInfo?: CustomerInfo; } /** * URLs the buyer is redirected to after the checkout flow. * * The buyer is sent to one of the URLs below: `continueBrowsingUrl` if they explicitly leave via * **Continue browsing**, or `thankYouPageUrl` after a successful payment. * * If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no * callback URL is invoked and the checkout session isn't resumed. */ interface CallbackUrls { /** * URL the buyer is redirected to from the Wix checkout page when they choose to leave without * completing payment, either when they click **Continue browsing** or when they navigate back to * a cart-style page. * * Deprecated. Use `continueBrowsingUrl` instead. * @format WEB_URL * @deprecated * @replacedBy continue_browsing_url */ postFlowUrl?: string | null; /** * URL the buyer is redirected to after a successful payment. * @format WEB_URL */ thankYouPageUrl?: string | null; /** * URL the buyer is redirected to from the Wix checkout page when they choose to leave without * completing payment, either when they click **Continue browsing** or when they navigate back to * a cart-style page. * @format WEB_URL */ continueBrowsingUrl?: string | null; } /** Response after creating a checkout session. */ interface GenerateCheckoutSessionResponse { /** The created checkout session. */ checkoutSession?: CheckoutSession; } /** Request to register a webhook URL. */ interface RegisterCheckoutSessionWebhookRequest { /** * URL to receive webhook notifications. * @format WEB_URL */ url?: string | null; /** * Webhook event types to register. Default: `[ORDER_APPROVED]`. * @maxSize 10 */ webhookTypes?: WebhookTypeWithLiterals[]; } /** Webhook event types to register. */ declare enum WebhookType { /** Order Approved webhook (`wix.ecom.v1.order_approved`). */ ORDER_APPROVED = "ORDER_APPROVED", /** * Subscription Contract Canceled webhook * (`wix.ecom.subscription_contracts.v1.subscription_contract_canceled`). */ SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED", /** * Subscription Contract Expired webhook * (`wix.ecom.subscription_contracts.v1.subscription_contract_expired`). */ SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED" } /** @enumType */ type WebhookTypeWithLiterals = WebhookType | 'ORDER_APPROVED' | 'SUBSCRIPTION_CANCELED' | 'SUBSCRIPTION_ENDED'; /** Response after registering a webhook. */ interface RegisterCheckoutSessionWebhookResponse { /** * PEM-formatted RS256 public key used to verify the JWT signature on incoming webhook payloads. * @maxLength 1000 */ publicKey?: string | null; } /** @docsIgnore */ type GenerateCheckoutSessionApplicationErrors = { code?: 'MULTIPLE_SUBSCRIPTION_ITEMS'; description?: string; data?: Record; } | { code?: 'AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT'; description?: string; data?: Record; }; type __PublicMethodMetaInfo = { getUrl: (context: any) => string; httpMethod: K; path: string; pathParams: M; __requestType: T; __originalRequestType: S; __responseType: Q; __originalResponseType: R; }; declare function generateCheckoutSession(): __PublicMethodMetaInfo<'POST', {}, GenerateCheckoutSessionRequest$1, GenerateCheckoutSessionRequest, GenerateCheckoutSessionResponse$1, GenerateCheckoutSessionResponse>; export { type CallbackUrls as CallbackUrlsOriginal, type Cart as CartOriginal, type CheckoutSession as CheckoutSessionOriginal, type CustomerInfo as CustomerInfoOriginal, type FreeTrialPeriod as FreeTrialPeriodOriginal, type GenerateCheckoutSessionApplicationErrors as GenerateCheckoutSessionApplicationErrorsOriginal, type GenerateCheckoutSessionRequest as GenerateCheckoutSessionRequestOriginal, type GenerateCheckoutSessionResponse as GenerateCheckoutSessionResponseOriginal, type LineItem as LineItemOriginal, type PhysicalProperties as PhysicalPropertiesOriginal, type RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal, type RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal, SubscriptionFrequency as SubscriptionFrequencyOriginal, type SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal, type SubscriptionInfo as SubscriptionInfoOriginal, type SubscriptionSettings as SubscriptionSettingsOriginal, WebhookType as WebhookTypeOriginal, type WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal, type __PublicMethodMetaInfo, generateCheckoutSession };