When onPlanPurchased() is triggered the event object contains details about the pricing plan that can be easily saved to the CMS. But I’d like to add one additional piece of info (orderNumber - an order number that was already generated in the frontend before the plan was purchased) into the orderData object before inserting it into the CMS. Is there a way to pass this variable from the frontend to the backend events.js?
events.js backend code:
import wixData from "wix-data";
export async function wixPaidPlans_onPlanPurchased(event)
let orderData = {
planType: event.order.planName,
planCost: event.order.price.amount,
planExpires: event.order.validUntil,
};
await wixData.insert("PlanPurchases", orderData);
}