> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreatePlan # Package: pricingPlans # Namespace: PlanService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/plans-v3/create-plan.md ## Permission Scopes: Manage Pricing Plans: SCOPE.DC-PAIDPLANS.MANAGE-PLANS ## Introduction Creates a plan with specified billing terms and a pricing strategy. To create the most common types of plans: - **One-time**: Specify a `billingCycle` that's the desired duration and set `endType` to `CYCLES_COMPLETED` and `cyclesCompletedDetails.billingCycleCount` to `1`. - **Recurring**: Define the recurrence rule using the plan's `billingCycle` object. - **Free plan**: Set the plan's `flatRate.amount` to `0` and `maxPurchasesPerBuyer` to `1`. --- ## REST API ### Schema ``` Method: createPlan Description: Creates a plan with specified billing terms and a pricing strategy. To create the most common types of plans: - **One-time**: Specify a `billingCycle` that's the desired duration and set `endType` to `CYCLES_COMPLETED` and `cyclesCompletedDetails.billingCycleCount` to `1`. - **Recurring**: Define the recurrence rule using the plan's `billingCycle` object. - **Free plan**: Set the plan's `flatRate.amount` to `0` and `maxPurchasesPerBuyer` to `1`. URL: https://www.wixapis.com/pricing-plans/v3/plans Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: plan, plan.visibility Method parameters: param name: idempotencyKey | type: idempotencyKey | description: Unique key to prevent duplicate plan creation. If the same key is used within a short time period, the original plan will be returned instead of creating a duplicate. param name: plan | type: Plan | required: true - name: name | type: string | description: Plan name displayed to customers. - name: description | type: string | description: Plan description that explains what customers get with this plan. - name: image | type: Image | description: Plan image displayed during checkout and on the site's **Plans & Pricing** page. - name: id | type: string | description: WixMedia image GUID. - name: altText | type: string | description: Image alt text. - name: slug | type: string | description: Unique identifier for this plan within the Wix site. If not provided, generated automatically from the plan name. - name: termsAndConditions | type: string | description: Terms and conditions text that customers must agree to when purchasing this plan. - name: perks | type: array | description: List of text snippets describing what the plan offers. For display purposes only. - name: id | type: string | description: Perk GUID. - name: description | type: string | description: Perk description. - name: visibility | type: Visibility | description: Plan visibility. | required: true - enum: - PUBLIC: Plan is visible and available for purchase by all customers. - PRIVATE: Plan isn't visible to new customers unless they get a specific link to the plan. Existing buyers can continue using it. - name: buyable | type: boolean | description: Whether customers can currently purchase this plan. If set to `false`, customer won't be able to buy a plan themselves. In this case a Wix user has to assign the plan through the [dashboard](https://support.wix.com/en/article/pricing-plans-selling-plans-offline). - name: formId | type: string | description: GUID of the form associated with the plan at checkout. - name: buyerCanCancel | type: boolean | description: Whether buyers can cancel their subscription to this plan. - name: purchaseLimits | type: array | description: Caps how many subscriptions buyers can have or the site can sell for this plan. When multiple types are present, all must pass (AND logic). Duplicate types are rejected by the server. - name: type | type: PurchaseLimitType | description: The type of purchase limit. - enum: - PER_MEMBER_LIFETIME: Limits the total number of subscriptions (any status) a single member can have over their lifetime. - PER_MEMBER_ACTIVE: Limits the number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions a single member can have at any time. - TOTAL_ACTIVE: Limits the total number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions across all members at any time. - TOTAL_SOLD: Limits the total number of subscriptions ever created (any status) across all members. - name: maxCount | type: integer | description: The maximum number of subscriptions allowed. - name: extendedFields | type: ExtendedFields | description: Data extensions. Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md). - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). Return type: CreatePlanResponse - name: plan | type: Plan | description: Created plan. - name: id | type: string | description: Plan GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the plan is updated. - name: createdDate | type: string | description: Date and time the plan was created. - name: updatedDate | type: string | description: Date and time the plan was last updated. - name: name | type: string | description: Plan name displayed to customers. - name: description | type: string | description: Plan description that explains what customers get with this plan. - name: image | type: Image | description: Plan image displayed during checkout and on the site's **Plans & Pricing** page. - name: id | type: string | description: WixMedia image GUID. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: slug | type: string | description: Unique identifier for this plan within the Wix site. If not provided, generated automatically from the plan name. - name: termsAndConditions | type: string | description: Terms and conditions text that customers must agree to when purchasing this plan. - name: perks | type: array | description: List of text snippets describing what the plan offers. For display purposes only. - name: id | type: string | description: Perk GUID. - name: description | type: string | description: Perk description. - name: visibility | type: Visibility | description: Plan visibility. - enum: - PUBLIC: Plan is visible and available for purchase by all customers. - PRIVATE: Plan isn't visible to new customers unless they get a specific link to the plan. Existing buyers can continue using it. - name: buyable | type: boolean | description: Whether customers can currently purchase this plan. If set to `false`, customer won't be able to buy a plan themselves. In this case a Wix user has to assign the plan through the [dashboard](https://support.wix.com/en/article/pricing-plans-selling-plans-offline). - name: formId | type: string | description: GUID of the form associated with the plan at checkout. - name: buyerCanCancel | type: boolean | description: Whether buyers can cancel their subscription to this plan. - name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. - name: purchaseLimits | type: array | description: Caps how many subscriptions buyers can have or the site can sell for this plan. When multiple types are present, all must pass (AND logic). Duplicate types are rejected by the server. - name: type | type: PurchaseLimitType | description: The type of purchase limit. - enum: - PER_MEMBER_LIFETIME: Limits the total number of subscriptions (any status) a single member can have over their lifetime. - PER_MEMBER_ACTIVE: Limits the number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions a single member can have at any time. - TOTAL_ACTIVE: Limits the total number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions across all members at any time. - TOTAL_SOLD: Limits the total number of subscriptions ever created (any status) across all members. - name: maxCount | type: integer | description: The maximum number of subscriptions allowed. - name: extendedFields | type: ExtendedFields | description: Data extensions. Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md). - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: AT_LEAST_ONE_ACTIVE_VARIANT | Description: At least one pricing variant must be active. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PERK_IDS_UNIQUE | Description: All perk GUIDs in the plan must be unique. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FEE_IDS_UNIQUE | Description: All fee GUIDs in the plan must be unique. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRICING_VARIANT_IDS_UNIQUE | Description: All pricing variant GUIDs in the plan must be unique. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CYCLES_COMPLETED_END_OPTION_IS_APPLICABLE | Description: Plans with `endType` set to `CYCLES_COMPLETED` must specify the number of billing cycles. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FREE_TRIAL_IS_APPLICABLE | Description: Only recurring paid plans can have a free trial. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FREE_PRICING_VARIANT_IS_NOT_RECURRING | Description: Recurring plans can't be free. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALID_PLAN_DURATION | Description: Plan duration can't exceed 10 years. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALID_BILLING_CYCLE | Description: Billing cycle must be at least 7 days and can't exceed 10 years. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NAME_NOT_BLANK | Description: Plan or fee `name` can't be blank. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CURRENCY_MISSING | Description: Currency isn't set in site settings. ``` ### Examples ### Create a recurring plan with limited duration Create a plan that bills every 3 months and ends after 1 year. Results in 4 total payments. ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "pricingVariants": [ { "pricingStrategies": [ { "flatRate": { "amount": "5.99" } } ], "id": "43c0efb3-8c99-4423-bae4-7366dc387e6a", "name": "Every 3 months", "billingTerms": { "billingCycle": { "period": "MONTH", "count": 3 }, "startType": "ON_PURCHASE", "endType": "CYCLES_COMPLETED", "cyclesCompletedDetails": { "billingCycleCount": 4 } } } ], "perks": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "description": "90-day business growth strategy consultation" }, { "id": "06b84a3e-e192-4fe0-85f8-76c5487c2c4c", "description": "Marketing automation tools and templates" }, { "id": "ca22b202-4f01-46b9-a420-5e06196bc6ec", "description": "Lead generation and CRM integration" }, { "id": "c125a696-14bf-46af-a400-6c927c62d1e1", "description": "Performance tracking and growth metrics" }, { "id": "7f986f88-e6e8-4961-93a5-9d87066441ba", "description": "Access to exclusive business growth webinars" } ], "name": "Business Growth Suite", "visibility": "PUBLIC", "buyable": true, "status": "ACTIVE", "buyerCanCancel": true } }' ``` ### Create a free plan with limited duration that's available only once Create a free plan that ends after 1 month and the buyer can never subscribe to again. ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "pricingVariants": [ { "pricingStrategies": [ { "flatRate": { "amount": "0" } } ], "id": "38291823-6f33-4f34-a8e1-b8fed9b2ab42", "name": "Free", "billingTerms": { "billingCycle": { "period": "MONTH", "count": 1 }, "startType": "ON_PURCHASE", "endType": "CYCLES_COMPLETED", "cyclesCompletedDetails": { "billingCycleCount": 1 } } } ], "perks": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "description": "Professional content creation tools and templates" }, { "id": "06b84a3e-e192-4fe0-85f8-76c5487c2c4c", "description": "Advanced video editing and audio enhancement suite" }, { "id": "ca22b202-4f01-46b9-a420-5e06196bc6ec", "description": "Multi-platform publishing and scheduling automation" } ], "name": "Free Trial Access", "visibility": "PUBLIC", "buyable": true, "status": "ACTIVE", "buyerCanCancel": true, "maxPurchasesPerBuyer": 1 } }' ``` ### Create a recurring plan that begins with a free trial period Buyers will only be billed after the first 10 days. In this example, the plan then bills monthly and only ends if canceled. ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "pricingVariants": [ { "pricingStrategies": [ { "flatRate": { "amount": "5.99" } } ], "id": "6304bd66-128e-454e-8c95-e389b78cc7e1", "name": "Monthly", "freeTrialDays": 10, "billingTerms": { "billingCycle": { "period": "MONTH", "count": 1 }, "startType": "ON_PURCHASE", "endType": "UNTIL_CANCELLED" } } ], "perks": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "description": "24/7 priority customer support" }, { "id": "06b84a3e-e192-4fe0-85f8-76c5487c2c4c", "description": "Unlimited API calls and data storage" }, { "id": "ca22b202-4f01-46b9-a420-5e06196bc6ec", "description": "10 days free trial" } ], "name": "Professional Studio", "visibility": "PUBLIC", "buyable": true, "status": "ACTIVE", "buyerCanCancel": true } }' ``` ### Create a one-time payment plan with limited duration Create a plan that bills once upfront and ends after 1 month. ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "pricingVariants": [ { "pricingStrategies": [ { "flatRate": { "amount": "5.99" } } ], "id": "38291823-6f33-4f34-a8e1-b8fed9b2ab42", "name": "Quarterly", "billingTerms": { "billingCycle": { "period": "MONTH", "count": 1 }, "startType": "ON_PURCHASE", "endType": "CYCLES_COMPLETED", "cyclesCompletedDetails": { "billingCycleCount": 1 } } } ], "perks": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "description": "Professional content creation tools and templates" }, { "id": "06b84a3e-e192-4fe0-85f8-76c5487c2c4c", "description": "Advanced video editing and audio enhancement suite" }, { "id": "ca22b202-4f01-46b9-a420-5e06196bc6ec", "description": "Multi-platform publishing and scheduling automation" } ], "name": "Creator Pro Access", "visibility": "PUBLIC", "buyable": true, "status": "ACTIVE", "buyerCanCancel": true } }' ``` ### Create a plan that only a Wix user can assign to a customer Customers can't view or subscribe to this plan on their own. In this example, the plan bills every 3 months and ends after 1 year. ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "visibility": "PRIVATE", "buyable": false, "status": "ACTIVE", "pricingVariants": [ { "pricingStrategies": [ { "flatRate": { "amount": "5.99" } } ], "id": "38291823-6f33-4f34-a8e1-b8fed9b2ab42", "name": "Quarterly", "billingTerms": { "billingCycle": { "period": "MONTH", "count": 3 }, "startType": "ON_PURCHASE", "endType": "CYCLES_COMPLETED", "cyclesCompletedDetails": { "billingCycleCount": 4 } } } ], "name": "Creator Pro Access", "buyerCanCancel": true } }' ``` ### Create a recurring plan with no end date Create a plan that bills monthly and only ends if canceled. ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "pricingVariants": [ { "pricingStrategies": [ { "flatRate": { "amount": "5.99" } } ], "id": "6304bd66-128e-454e-8c95-e389b78cc7e1", "name": "Monthly", "billingTerms": { "billingCycle": { "period": "MONTH", "count": 1 }, "startType": "ON_PURCHASE", "endType": "UNTIL_CANCELLED" } } ], "perks": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "description": "24/7 priority customer support" }, { "id": "06b84a3e-e192-4fe0-85f8-76c5487c2c4c", "description": "Unlimited API calls and data storage" }, { "id": "ca22b202-4f01-46b9-a420-5e06196bc6ec", "description": "Advanced analytics and reporting dashboard" } ], "name": "Professional Studio", "visibility": "PUBLIC", "buyable": true, "status": "ACTIVE", "buyerCanCancel": true } }' ``` ### Create a one-time payment plan with no end date Create a plan that bills once upfront and only ends if canceled. ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "pricingVariants": [ { "pricingStrategies": [ { "flatRate": { "amount": "5.99" } } ], "id": "30f9715d-7e02-420f-a13a-087cbf5f5790", "name": "Single", "billingTerms": { "billingCycle": null, "startType": "ON_PURCHASE", "endType": "UNTIL_CANCELLED" } } ], "perks": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "description": "Advanced data visualization and custom dashboards" }, { "id": "06b84a3e-e192-4fe0-85f8-76c5487c2c4c", "description": "Real-time analytics with automated reporting" }, { "id": "ca22b202-4f01-46b9-a420-5e06196bc6ec", "description": "Enterprise-grade security and compliance" }, { "id": "c125a696-14bf-46af-a400-6c927c62d1e1", "description": "Unlimited data retention and export capabilities" } ], "name": "Enterprise Analytics", "visibility": "PUBLIC", "buyable": true, "status": "ACTIVE", "buyerCanCancel": true } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.pricingPlans.PlanService.createPlan(plan, options) Description: Creates a plan with specified billing terms and a pricing strategy. To create the most common types of plans: - **One-time**: Specify a `billingCycle` that's the desired duration and set `endType` to `CYCLES_COMPLETED` and `cyclesCompletedDetails.billingCycleCount` to `1`. - **Recurring**: Define the recurrence rule using the plan's `billingCycle` object. - **Free plan**: Set the plan's `flatRate.amount` to `0` and `maxPurchasesPerBuyer` to `1`. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: plan, plan.visibility Method parameters: param name: options | type: CreatePlanOptions none - name: idempotencyKey | type: string | description: Unique key to prevent duplicate plan creation. If the same key is used within a short time period, the original plan will be returned instead of creating a duplicate. param name: plan | type: Plan | required: true - name: name | type: string | description: Plan name displayed to customers. - name: description | type: string | description: Plan description that explains what customers get with this plan. - name: image | type: string | description: Plan image displayed during checkout and on the site's **Plans & Pricing** page. - name: slug | type: string | description: Unique identifier for this plan within the Wix site. If not provided, generated automatically from the plan name. - name: termsAndConditions | type: string | description: Terms and conditions text that customers must agree to when purchasing this plan. - name: perks | type: array | description: List of text snippets describing what the plan offers. For display purposes only. - name: _id | type: string | description: Perk GUID. - name: description | type: string | description: Perk description. - name: visibility | type: Visibility | description: Plan visibility. | required: true - enum: - PUBLIC: Plan is visible and available for purchase by all customers. - PRIVATE: Plan isn't visible to new customers unless they get a specific link to the plan. Existing buyers can continue using it. - name: buyable | type: boolean | description: Whether customers can currently purchase this plan. If set to `false`, customer won't be able to buy a plan themselves. In this case a Wix user has to assign the plan through the [dashboard](https://support.wix.com/en/article/pricing-plans-selling-plans-offline). - name: formId | type: string | description: GUID of the form associated with the plan at checkout. - name: buyerCanCancel | type: boolean | description: Whether buyers can cancel their subscription to this plan. - name: purchaseLimits | type: array | description: Caps how many subscriptions buyers can have or the site can sell for this plan. When multiple types are present, all must pass (AND logic). Duplicate types are rejected by the server. - name: type | type: PurchaseLimitType | description: The type of purchase limit. - enum: - PER_MEMBER_LIFETIME: Limits the total number of subscriptions (any status) a single member can have over their lifetime. - PER_MEMBER_ACTIVE: Limits the number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions a single member can have at any time. - TOTAL_ACTIVE: Limits the total number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions across all members at any time. - TOTAL_SOLD: Limits the total number of subscriptions ever created (any status) across all members. - name: maxCount | type: integer | description: The maximum number of subscriptions allowed. - name: extendedFields | type: ExtendedFields | description: Data extensions. Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md). - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). Return type: PROMISE - name: _id | type: string | description: Plan GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the plan is updated. - name: _createdDate | type: Date | description: Date and time the plan was created. - name: _updatedDate | type: Date | description: Date and time the plan was last updated. - name: name | type: string | description: Plan name displayed to customers. - name: description | type: string | description: Plan description that explains what customers get with this plan. - name: image | type: string | description: Plan image displayed during checkout and on the site's **Plans & Pricing** page. - name: slug | type: string | description: Unique identifier for this plan within the Wix site. If not provided, generated automatically from the plan name. - name: termsAndConditions | type: string | description: Terms and conditions text that customers must agree to when purchasing this plan. - name: perks | type: array | description: List of text snippets describing what the plan offers. For display purposes only. - name: _id | type: string | description: Perk GUID. - name: description | type: string | description: Perk description. - name: visibility | type: Visibility | description: Plan visibility. - enum: - PUBLIC: Plan is visible and available for purchase by all customers. - PRIVATE: Plan isn't visible to new customers unless they get a specific link to the plan. Existing buyers can continue using it. - name: buyable | type: boolean | description: Whether customers can currently purchase this plan. If set to `false`, customer won't be able to buy a plan themselves. In this case a Wix user has to assign the plan through the [dashboard](https://support.wix.com/en/article/pricing-plans-selling-plans-offline). - name: formId | type: string | description: GUID of the form associated with the plan at checkout. - name: buyerCanCancel | type: boolean | description: Whether buyers can cancel their subscription to this plan. - name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. - name: purchaseLimits | type: array | description: Caps how many subscriptions buyers can have or the site can sell for this plan. When multiple types are present, all must pass (AND logic). Duplicate types are rejected by the server. - name: type | type: PurchaseLimitType | description: The type of purchase limit. - enum: - PER_MEMBER_LIFETIME: Limits the total number of subscriptions (any status) a single member can have over their lifetime. - PER_MEMBER_ACTIVE: Limits the number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions a single member can have at any time. - TOTAL_ACTIVE: Limits the total number of ongoing (ACTIVE, PENDING, PAUSED) subscriptions across all members at any time. - TOTAL_SOLD: Limits the total number of subscriptions ever created (any status) across all members. - name: maxCount | type: integer | description: The maximum number of subscriptions allowed. - name: extendedFields | type: ExtendedFields | description: Data extensions. Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md). - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: AT_LEAST_ONE_ACTIVE_VARIANT | Description: At least one pricing variant must be active. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PERK_IDS_UNIQUE | Description: All perk GUIDs in the plan must be unique. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FEE_IDS_UNIQUE | Description: All fee GUIDs in the plan must be unique. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRICING_VARIANT_IDS_UNIQUE | Description: All pricing variant GUIDs in the plan must be unique. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CYCLES_COMPLETED_END_OPTION_IS_APPLICABLE | Description: Plans with `endType` set to `CYCLES_COMPLETED` must specify the number of billing cycles. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FREE_TRIAL_IS_APPLICABLE | Description: Only recurring paid plans can have a free trial. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FREE_PRICING_VARIANT_IS_NOT_RECURRING | Description: Recurring plans can't be free. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALID_PLAN_DURATION | Description: Plan duration can't exceed 10 years. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALID_BILLING_CYCLE | Description: Billing cycle must be at least 7 days and can't exceed 10 years. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NAME_NOT_BLANK | Description: Plan or fee `name` can't be blank. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CURRENCY_MISSING | Description: Currency isn't set in site settings. ``` ### Examples ### createPlan ```javascript import { plansV3 } from '@wix/pricing-plans'; async function createPlan(plan,options) { const response = await plansV3.createPlan(plan,options); }; ``` ### createPlan (with elevated permissions) ```javascript import { plansV3 } from '@wix/pricing-plans'; import { auth } from '@wix/essentials'; async function myCreatePlanMethod(plan,options) { const elevatedCreatePlan = auth.elevate(plansV3.createPlan); const response = await elevatedCreatePlan(plan,options); } ``` ### createPlan (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { plansV3 } from '@wix/pricing-plans'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { plansV3 }, // Include the auth strategy and host as relevant }); async function createPlan(plan,options) { const response = await myWixClient.plansV3.createPlan(plan,options); }; ``` ---