/** * The wix-pricing-plans-frontend module contains functionality for working with * pricing plans from frontend code. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.html#) */ declare module 'wix-pricing-plans-frontend' { /** * The Pricing Plans Checkout API contains functionality for ordering, checking out, and purchasing * a site's pricing plan [orders](https://support.wix.com/en/article/pricing-plans-an-overview). * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.html#checkout) */ const checkout: Checkout; /** * The Custom Purchase Flow API contains functionality for customizing the plan purchase flow on a site. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.html#customPurchaseFlow) */ const customPurchaseFlow: CustomPurchaseFlow; /** * The Pricing Plan Orders API provides functionality for managing pricing plan orders created in the Wix Pricing Plans app or using the Wix Pricing Plans API. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.html#orders) */ const orders: Orders; /** * Contains functionality for ordering a site's pricing plans. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Checkout.html#) */ interface Checkout { /** * Orders a pricing plan. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Checkout.html#createOnlineOrder) */ createOnlineOrder(planId: string, startDate?: Date): Promise; /** * Orders and purchases a pricing plan. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Checkout.html#startOnlinePurchase) */ startOnlinePurchase(planId: string, startDate?: Date): Promise; } /** * The Custom Purchase Flow API contains functionality for customizing the plan purchase flow on a site. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.CustomPurchaseFlow.html#) */ interface CustomPurchaseFlow { /** * Returns the options set for the current Plans & Pricing page. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.CustomPurchaseFlow.html#getPricingPageOptions) */ getPricingPageOptions(): Promise; /** * Directs site visitor to the Checkout page in the plan purchase flow. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.CustomPurchaseFlow.html#navigateToCheckout) */ navigateToCheckout(options: CustomPurchaseFlow.CheckoutOptions): void; /** * Directs site visitor to the Pricing & Plans page in the plan purchase flow. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.CustomPurchaseFlow.html#navigateToPricingPage) */ navigateToPricingPage(options: CustomPurchaseFlow.PricingPageOptions): void; } /** * The Pricing Plans Orders API contains functionality for managing * a site's pricing plan [orders](https://support.wix.com/en/article/pricing-plans-an-overview). * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Orders.html#) */ interface Orders { /** * Lists the orders for the currently logged-in member. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Orders.html#listCurrentMemberOrders) */ listCurrentMemberOrders(filters?: Orders.CurrentMemberFilterOptions, sorting?: Orders.SortingOptions, paging?: Orders.PaginationOptions): Promise; /** * Requests the cancellation of a specific order of a plan for the currently logged-in member. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Orders.html#requestCurrentMemberOrderCancellation) */ requestCurrentMemberOrderCancellation(orderId: string, effectiveAt: string): Promise; } /** * Contains functionality for ordering a site's pricing plans. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Checkout.html#) */ namespace Checkout { /** * An object representing the period for which a plan is valid. */ type Period = { /** * The number of units until the plan expires. */ amount: number; /** * Time period for billing the plan, such as `"MONTH"`. */ unit: string; }; /** * An object representing the price of a purchased plan. */ type Price = { /** * Payment currency. A three-letter * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. */ currency: string; /** * The cost of the plan. */ amount: number; }; /** * An object representing a purchase for a non-free plan. */ type Purchase = { /** * The order being purchased. */ order: Orders.Order; /** * Payment status in [Wix Pay](https://www.wix.com/velo/reference/wix-pay-frontend). Omitted for free plans. * One of: * + `"Successful"`: Payment was successfully received. * + `"Pending"`: Payment is pending payment provider approval. * + `"Failed"`: Payment has failed. * + `"Chargeback"`: Payment is chargeback. * + `"Refunded"`: Payment was fully refunded. * + `"Offline"`: Payment will be executed offline. * + `"PartiallyRefunded"`: Payment was partially refunded. * + `"Cancelled"`: Payment was cancelled and was not processed. * + `"Undefined"`: Payment status is pending payment provider input. */ wixPayStatus?: string; }; /** * An object representing how long a plan is valid. */ type ValidFor = { /** * If true, the plan does not expire. */ forever: boolean; /** * Object containing the period for which the plan is valid. */ period: Checkout.Period; }; } /** * The Custom Purchase Flow API contains functionality for customizing the plan purchase flow on a site. * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.CustomPurchaseFlow.html#) */ namespace CustomPurchaseFlow { /** * Sets the data associated with the Checkout page. */ type CheckoutOptions = { /** * Selected pricing plan ID. */ planId: string; /** * Earliest date the selected plan can start in `yyyy-MM-dd` format. */ minStartDate?: string; /** * Latest date the selected plan can start in `yyyy-MM-dd` format. */ maxStartDate?: string; /** * The data associated with the Thank You page. */ thankYouPage?: CustomPurchaseFlow.ThankYouPage; }; /** * Sets the data associated with the Checkout page. */ type CheckoutPageOptions = { /** * Earliest date the selected plan can start in `yyyy-MM-dd` format. */ minStartDate?: string; /** * Latest date the selected plan can start in `yyyy-MM-dd` format. */ maxStartDate?: string; /** * The data associated with the Thank You page. */ thankYouPage?: CustomPurchaseFlow.ThankYouPage; }; /** * Settings for the display of the Plans & Pricing page and subsequent pages in the plan purchase flow. */ type PricingPageOptions = { /** * List of plan IDs displayed on the Plans & Pricing page. */ planIds?: string[]; /** * Plans & Pricing page title. */ title?: string; /** * Plans & Pricing page subtitle. */ subtitle?: string; /** * The data associated with the Checkout page. */ checkout?: CustomPurchaseFlow.CheckoutPageOptions; }; /** * Options to customize the Thank You page that's displayed after a customer purchases a plan. */ type ThankYouPage = { /** * The content displayed on the Thank You page. */ content?: CustomPurchaseFlow.content; /** * The page to navigate to when a user clicks the button on the Thank You Page. * It must be a page on a site. */ navigation?: CustomPurchaseFlow.navigation; }; /** * The content displayed on the Thank You page. */ type content = { /** * Thank You page title. */ title?: string; /** * Thank You page body. */ message?: string; /** * Thank You page button label. */ cta?: string; }; /** * The page to navigate to when a user clicks the button on the Thank You Page. * It must be a page on a site. */ type navigation = { /** * URL of a page on a site. The link may be relative or a site's base URL. Examples: * + `/home` * + `https://my.wixsite.com/path` */ url: string; /** * Link type. * * Supported values: * - `"url"` */ type: string; }; } /** * The Pricing Plans Orders API contains functionality for managing * a site's pricing plan [orders](https://support.wix.com/en/article/pricing-plans-an-overview). * [Read more](https://www.wix.com/corvid/reference/wix-pricing-plans-frontend.Orders.html#) */ namespace Orders { /** * Buyer details. */ type Buyer = { /** * Member ID for the buyer. See the Members API to learn more about a site's members. */ memberId: string; /** * Contact ID for the buyer. See the Contacts API to learn more about a site's contacts. */ contactId: string; }; /** * Details about the cancellation of an order. Only present if the order `status` is `"CANCELED"`. */ type Cancellation = { /** * Date and time when the cancellation was requested. */ requestedDate: Date; /** * The reason for the cancellation. * Supported values: * + `"OWNER_ACTION"`: The Wix user canceled the order. * + `"MEMBER_ACTION"`: The buyer initiated the cancellation. * + `"PAYMENT_FAILURE"`: A payment transaction failed. * + `"PAYMENT_SETUP_FAILURE"`: The buyer's payment details weren't set up correctly. */ cause: string; /** * When the cancellation takes effect. Set when cancelling the order. * Supported values: * + `"IMMEDIATELY"`: The cancellation occurs immediately and the buyer can no longer use the plan at this point. * + `"NEXT_PAYMENT_DATE"`: The cancellation occurs at the next payment date and time. The buyer can continue to use the plan until that date and time. */ effectiveAt: string; }; /** * Coupon applied to the order. * * To learn more about coupons, see `applyCoupon()`. */ type Coupon = { /** * Code of the applied coupon. */ code: string; /** * Total discount of the coupon, as a monetary amount. */ amount: string; /** * Coupon ID. */ id: string; }; /** * Current payment cycle for the order. * * `currentCycle` will be omitted if the order's `status` is `CANCELED` or `ENDED`, or if the `startDate` hasn't been reached yet. */ type CurrentCycle = { /** * Index of the current payment cycle in the order. * * `0` when the order is in a free trial period. In all other cases, the index starts with `1`. */ index: number; /** * Start date and time for the current payment cycle. */ startedDate: Date; /** * End date and time for the current payment cycle. */ endedDate: Date; }; /** * Fields to filter by when listing orders for the current member. */ type CurrentMemberFilterOptions = { /** * Specific IDs of plans that were ordered by the current member. */ planIds?: string[]; /** * Whether the auto-renewal of the current member's recurring orders was canceled. */ autoRenewCanceled?: boolean; /** * Specific statuses for the current member's orders. * + `"DRAFT"`: The order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use. * + `"PENDING"`: Payment is being processed. The plan isn't yet available for use. * + `"ACTIVE"`: The order has been processed and paid for. The plan is available for use. * + `"PAUSED"`: Use of the plan has been paused, see `pauseOrder()`, for example, if the buyer is away. The plan can be resumed, see `resumeOrder()`. * + `"ENDED"`: The order has completed its duration and is no longer available for use. * + `"CANCELED"`: The order has been canceled, see `cancelOrder()`. */ orderStatuses?: string[]; /** * Specific payment statuses for the current member's orders. * + `"PAID"`: The last payment was paid. * + `"REFUNDED"`: The last payment was refunded. * + `"FAILED"`: The last payment transaction didn't complete. * + `"UNPAID"`: The last payment wasn't paid. * + `"PENDING"`: Awaiting payment. * + `"NOT_APPLICABLE"`: No payment was necessary, such as for free plans or free trials. */ paymentStatuses?: string[]; }; /** * Length of one payment cycle. For example, `1` `MONTH` for monthly payments. */ type Duration = { /** * The amount of a duration `unit` in a single payment cycle. * * Currently limited to support only value of `1`. */ count: number; /** * Unit of time for the cycle duration. * * Supported values: `"UNDEFINED"`, `"DAY"`, `"WEEK"`, `"MONTH"`, `"YEAR"` */ unit: string; }; type Order = { /** * Order ID. */ _id: string; /** * ID of the plan that was ordered. */ planId: string; /** * ID of the related Wix subscription. * * Every pricing plan order corresponds to a Wix subscription, including orders for single payment plans. You can see all orders from a site's [Subscriptions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fsubscriptions%3FreferralInfo%3Dvelo-docs) page in the dashboard. */ subscriptionId: string; /** * ID of the associated Wix Pay order. * * Created by the `createOnlineOrder()` or `createOfflineOrder()` method. For online orders, send this value as a parameter to the Wix Pay `startPayment()` method to enable a buyer to pay for an order. `wixPayOrderId` is omitted if the order is free. */ wixPayOrderId?: string; /** * The buyer's IDs. Includes `memberId` and `contactId`. * * Currently, Pricing Plan orders are limited to members only. `contactId` is returned, but a buyer won't be able to order a plan without a `memberId`. */ buyer: Orders.Buyer; /** * **Deprecated.** Use `pricing` instead. */ priceDetails: Orders.PriceDetails; /** * Order pricing model, price, and payment schedule. See Pricing Models ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/introduction#pricing-models) | [Velo](https://dev.wix.com/docs/velo/apis/wix-pricing-plans-backend/introduction#apis_wix-pricing-plans-backend_pricing-models)) to learn more. */ pricing?: Orders.Pricing; /** * How the order was processed. * Supported values: * + `"ONLINE"`: The buyer ordered the plan using the site. * + `"OFFLINE"`: The buyer made a manual, offline order without using the site. */ type: string; /** * Status of the order. * Supported values: * + `"DRAFT"`: The order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use. * + `"PENDING"`: The order has been processed and its start date is set in the future. The plan isn't yet available for use. * + `"ACTIVE"`: The order has been processed. The plan is available for use. * + `"PAUSED"`: The order and use of the plan is paused, see `pauseOrder()`. For example, if the buyer is away. The order and use of the plan can be resumed, see `resumeOrder()`. * + `"ENDED"`: The order has completed its duration and is no longer available for use. * + `"CANCELED"`: The order has been canceled, see `cancelOrder()`. */ status: string; /** * Whether the order will be canceled at the next payment date. * * If `true`, the order `status` will be `"CANCELED"` and the next payment won't be charged. Omitted for single payment orders. */ autoRenewCanceled?: boolean; /** * Details about the cancellation of an order. Only present if the `status` is `"CANCELED"`. */ cancellation?: Orders.Cancellation; /** * Status of the last payment for the order. This is updated automatically for online orders. The Wix user updates this manually for offline orders. * Supported values: * + `"PAID"`: The last payment was paid. * + `"REFUNDED"`: The last payment was refunded. * + `"FAILED"`: The last payment transaction didn't complete. * + `"UNPAID"`: The last payment wasn't paid. * + `"PENDING"`: Awaiting payment. * + `"NOT_APPLICABLE"`: No payment was necessary. For example, for free plans or free trials. */ lastPaymentStatus: string; /** * Start date and time for the ordered plan. */ startDate: Date; /** * Current date and time the ordered plan will expire. * * `endDate` may be updated over the course of an order. If the order is paused, see `pauseOrder()`, it will have a later `endDate` once it resumes, see `resumeOrder()`. `endDate` may also be postponed, see `postponeEndDate()`. * * Omitted if the order is valid until canceled and still `"ACTIVE"`. */ endDate?: Date; /** * List of periods during which this order is paused. */ pausePeriods: Orders.PausePeriod[]; /** * Free trial period, in days. Only available for recurring plans. */ freeTrialDays?: string; /** * Earliest end date and time that the plan for this order can expire. * * This is calculated by adding all pause periods to the original end date. Omitted if the order is active until canceled. Reserved for future use. */ earliestEndDate?: Date; /** * Current payment cycle for the order. * * `currentCycle` will be omitted if the order's status is `"CANCELED"` or `"ENDED"`, or if the `startDate` hasn't passed yet. */ currentCycle: Orders.CurrentCycle; /** * Name of the plan at the time of the order. */ planName: string; /** * Description of the plan at the time of the order. */ planDescription: string; /** * Plan price as it was at the moment of order creation. */ planPrice: string; /** * Date and time the order was created. */ _createdDate: Date; /** * Date and time the order was last updated. For example, the date and time an order was paused, resumed, or canceled. */ _updatedDate: Date; }; /** * The order has recurring payments. */ type OrderRecurrence = { /** * Length of one payment cycle. For example, `1` `MONTH` for monthly payments. */ cycleDuration: Orders.Duration; /** * Amount of payment cycles this subscription is valid for. * * `0` for orders of plans that are unlimited or until-canceled. */ cycleCount: number; }; type PaginationOptions = { /** * Limit the number of orders returned. * * Default: `50` */ limit?: number; /** * Number of entries to skip. */ skip?: number; }; /** * Period during which the order of a plan is suspended. */ type PausePeriod = { /** * Status of the pause period. * Supported values: * + `"ACTIVE"`. Status while the order is [paused](https://dev.wix.com/docs/velo/apis/wix-pricing-plans-v2/orders/pause-order). * + `"ENDED"`. Status while the order is [resumed](https://dev.wix.com/docs/velo/apis/wix-pricing-plans-v2/orders/resume-order). */ status: string; /** * Start date and time of the pause period. */ pauseDate: Date; /** * End date and time of the pause period. * * Omitted while the pause period remains `"ACTIVE"`. */ resumeDate: Date; }; /** * Order price details. */ type Price = { /** * Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`. */ subtotal: string; /** * Coupon applied to the order. * * To learn more about coupons, see `applyCoupon()`. */ coupon: Orders.Coupon; /** * Total discount applied to the order. */ discount: string; /** * Tax applied to the order. */ tax?: Orders.Tax; /** * Price after tax and discount is applied, specified as a monetary amount. For example, `"13.98"`. * * If no tax is applied, this amount is the same as `subtotal`. */ total: string; /** * 3-letter currency code in [ISO 4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. */ currency: string; }; /** * **Deprecated.** Use `pricing` instead. */ type PriceDetails = { /** * Price of the order, excluding tax. Specified as a monetary amount, such as `"3.99"`. */ subtotal: string; /** * Tax applied for the plan. Omitted if no tax was applied. */ tax?: Orders.Tax; /** * Price after tax is applied. Specified as a monetary amount, such as `"4.98"`. If no tax was applied, this amount is the same as `subtotal`. */ total: string; /** * Price of the plan when the order was created. This price is the amount for a single payment. For subscriptions, this is the amount to pay for each single payment cycle and the `planPrice` is required. Otherwise, the payment is for the entire plan. */ planPrice: string; /** * Currency code. Must be a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code (for example, `"USD"`). */ currency: string; /** * Pricing model indicating that the order has recurring payments. This type of subscription isn't a "Wix subscription," which encompasses various types of subscriptions, such as Wix Stores subscriptions, Wix invoice subscriptions, and *all* pricing plan models. */ subscription?: Orders.OrderRecurrence; /** * Pricing model indicating that the order is paid with a single payment per cycle and what the length of the cycle is. The cycle is the duration of the order's plan, not a payment cycle. */ singlePaymentForDuration?: Orders.Duration; /** * Pricing model indicating that the order of the plan is paid in 1 single payment and that the order is active until canceled. */ singlePaymentUnlimited?: boolean; /** * Free trial period for the order in days. Available only for orders whose plans are recurring, meaning plans whose pricing model is `subscription`. */ freeTrialDays?: number; }; /** * Cycle duration to apply `price` for. */ type PriceDuration = { /** * Price starts to apply with this cycle. * * `1` is the first payment cycle for all pricing models. */ cycleFrom: number; /** * Amount of cycles to apply price for. * * For `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`. * * For `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` isn't returned. * * For `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`. */ numberOfCycles: number; }; /** * Pricing details for all pricing models. */ type Prices = { /** * Cycle duration to apply `price` for. * * Use with all pricing models. Can apply the same price to multiple payment cycles. */ duration: Orders.PriceDuration; /** * Order price. */ price: Orders.Price; }; /** * Order pricing model, price, and payment schedule. */ type Pricing = { /** * Pricing model for an order with recurring payment cycles. */ subscription?: Orders.OrderRecurrence; /** * Pricing model for an order with a one-time payment and the order is valid for a specific amount of time. */ singlePaymentForDuration?: Orders.Duration; /** * Pricing model for an order with a one-time payment and the order is valid until canceled. */ singlePaymentUnlimited?: boolean; /** * Pricing details for all pricing models. */ prices: Orders.Prices; }; /** * Sorting details. */ type SortingOptions = { /** * Name of the property to sort by. * * Supported values: `_createdDate`, `endDate` * * Default: `_createdDate` */ fieldName?: string; /** * Sort order. * * Supported values: * + `"ASC"`: Ascending * + `"DESC"`: Descending * * Default: `"ASC"` */ order?: string; }; /** * Tax applied to the order. If empty, no tax was applied. */ type Tax = { /** * Name of the tax. For example, VAT. */ name: string; /** * Whether tax is included in the original price. When `false`, tax is added at checkout. */ includedInPrice: boolean; /** * Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`. */ rate: string; /** * Total tax, specified as a monetary amount. For example, `"3.99"`. */ amount: string; }; } }