What you are trying to do exactly? If you are just copying and pasting API references examples it will not work always these are just examples that you copied.
If you just want to create multiple plans with different features you don’t need code you can do it with Wix Paid Plans app.
onPlanPurchased( )
This event is triggering when someone buys a paid plan. How you can use it here is an example:
Let say you are telling to your customers that if they buy the “Diamond” plan they will be able to see some private pages on your website. So when someone buys a paid plan you can check if it’s a Diamond plan or not and after that, you can give them permission to let them see the private pages on your site.
However, you can do all these things from your Wix dashboard to but that was an example. That is what you can do with onPlanPurchased() event.