> 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 # UpdatePlan # Package: pricingPlans # Namespace: PlanService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/plans-v3/update-plan.md ## Permission Scopes: Manage Pricing Plans: SCOPE.DC-PAIDPLANS.MANAGE-PLANS Manage Pricing Plans: SCOPE.DC-PAIDPLANS.MANAGE-PLANS ## Introduction Updates a single plan. To update multiple plans at once, call Bulk Update Plans. --- ## REST API ### Schema ``` Method: updatePlan Description: Updates a single plan. To update multiple plans at once, call Bulk Update Plans. URL: https://www.wixapis.com/pricing-plans/v3/plans/{plan.id} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: plan, plan.id, plan.revision Method parameters: param name: plan | type: Plan | required: true - name: id | type: string | description: Plan GUID. | required: true - name: revision | type: string | description: Revision number, which increments by 1 each time the plan is updated. | 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. - 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: UpdatePlanResponse - name: plan | type: Plan | description: Updated 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: REQUIRED_FIELD | Description: The `slug` field can't be empty. 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. ``` ### Examples ### Update Plan ```curl curl -X PATCH \ 'https://www.wixapis.com/pricing-plans/v3/plans/5779edd3-2994-4bf4-acfe-d739ad2d95ac' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "plan": { "revision": "1", "pricingVariants": [ { "id": "6304bd66-128e-454e-8c95-e389b78cc7e1", "name": "Monthly", "billingTerms": { "startType": "ON_PURCHASE", "endType": "UNTIL_CANCELLED" }, "pricingStrategies": [ { "flatRate": { "amount": "2.99" } } ] } ] } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.pricingPlans.PlanService.updatePlan(_id, plan) Description: Updates a single plan. To update multiple plans at once, call Bulk Update Plans. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: plan, _id, plan.revision Method parameters: param name: _id | type: string | description: Plan GUID. | required: true param name: plan | type: UpdatePlan | required: true - name: revision | type: string | description: Revision number, which increments by 1 each time the plan is updated. | 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. - 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: REQUIRED_FIELD | Description: The `slug` field can't be empty. 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. ``` ### Examples ### Update a plan ```javascript import { plansV3 } from "@wix/pricing-plans"; const plan = { revision: "1", pricingVariants: [ { _id: "6304bd66-128e-454e-8c95-e389b78cc7e1", name: "Monthly", billingTerms: { startType: "ON_PURCHASE", endType: "UNTIL_CANCELLED", }, pricingStrategies: [ { flatRate: { amount: "2.99", }, }, ], }, ], }; async function updatePlan() { const response = await plansV3.updatePlan( "5779edd3-2994-4bf4-acfe-d739ad2d95ac", plan ); } ``` ### updatePlan (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 updatePlan(_id,plan) { const response = await myWixClient.plansV3.updatePlan(_id,plan); }; ``` ---