getPlan( )


Retrieves a pricing plan by ID.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Read Pricing Plans
Manage Events
Learn more about app permissions.
Method Declaration
Copy
function getPlan(_id: string): Promise<Plan>;
Method Parameters
_idstringRequired

Plan ID.

Returns
Return Type:Promise<Plan>
JavaScript
import { plans } from "wix-pricing-plans.v2"; /* Sample _id value: '838f2c9d-c8d0-4799-a10a-e2f23849db10' */ export async function myGetPlanFunction(_id) { try { const myPlan = await plans.getPlan(_id); return myPlan; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "_createdDate": "2024-01-07T07:28:42.863Z", * "_id": "838f2c9d-c8d0-4799-a10a-e2f23849db10", * "_updatedDate": "2024-01-07T08:36:07.520Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Complete with all features. One month free trial.", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - annual - 30 day trial", * "perks": { * "values": [ * "Unlimited video library streaming access", * "File sharing enabled for all channels" * ] * }, * "pricing": { * "freeTrialDays": 30, * "price": { * "currency": "EUR", * "value": "500" * }, * "subscription": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * } * } * }, * "primary": false, * "public": true, * "slug": "premium-plan-annual-30-day-trial-1", * "termsAndConditions": "Unlimited usage of services, subject to Fair Usage and Code of Conduct policies." * } */
Errors
428Failed Precondition

There is 1 error with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?