The memberid property seems to be missing. Where is it?
using wixPaidPlans_onPlanPurchased(event) and according to the documentation:
onPlanPurchased - Velo API Reference - Wix.com event.order.memberid should be available, but doesn’t show up
created a events.jsw in the back end of the editor.
Product:
Wix Editor, velo code
What are you trying to achieve:
When someone buys a plan:
- create a group
- assign the user who bought the plan as the admin/owner of that group
import wixData from 'wix-data';
import wixPricingPlansBackend from 'wix-pricing-plans-backend';
import wixGroupsBackend from 'wix-groups-backend';
import { groups } from 'wix-groups-backend';
//import wixPricingPlansBackend from 'wix-pricing-plans-backend';
// when a content creator buys a creator plan,
//1. create a group,
// 2. assign the creator account as the admin for that group
export function wixPaidPlans_onPlanPurchased(event)
{
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
const planId = event.data.planId;
const planName = event.data.planName;
const order = event.order ;
const groupInfo = {name:'My Group1'};
if (planId == "f261519e-4c31-46b6-a621-1f4026686431" )
{
groups.createGroup(groupInfo);
}
}